Outlook won't send e-mail when offline

Status
Not open for further replies.

soadfan

Member
Outlook version
Outlook 2013 64 bit
Email Account
Office 365 Exchange
I have this code, which is working fine, except if you don't have internet connection.
The problem is that Outlook doesn't send it when internet connection is back.
It doesn't appear in the Outbox folder either

So is there a way to send it automatically later?


Code:
Private Sub Application_Startup()
Dim objMsg As MailItem
Set objMsg = Application.CreateItem(olMailItem)
 With objMsg
  .To = "name@domain.ext"
  .CC = ""
  .BCC = ""
  .Subject = "Subject"
  .Body = "Body"
  .Send
End With

Set objMsg = Nothing
End Sub
 

soadfan

Member
Outlook version
Outlook 2013 64 bit
Email Account
Office 365 Exchange
Nope. It doesn't put it in the outbox at all.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
You're using an Exchange mailbox in cached mode, right? (Online mode shouldn't even open if offline.)
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
it's going into the outbox here... add msgbox "message created" at the end of your macro - does the message box come up?
offline.png
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Security settings weren't changed? (Shouldn't have been, otherwise it would fail manually too.)
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Add a msgbox as the first line - then restart outlook.

Private Sub Application_Startup()
MsgBox "Sending new message"
Dim objMsg As MailItem
 

soadfan

Member
Outlook version
Outlook 2013 64 bit
Email Account
Office 365 Exchange
Nope. It doesn't work.
Strange thing. Macros are enabled in security settings
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
In the VBA editor, go to tools, options - General tab. Is break on all errors selected?
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
(A gal can learn to hate edge - ever since the last windows update, about half the time, Enter posts replies instead of just adding a new line). Damn, shift enter does it too. Back to chrome. :)

This is what I'm trying, but not very successfully, to post:
break-errors.png
 

soadfan

Member
Outlook version
Outlook 2013 64 bit
Email Account
Office 365 Exchange
(A gal can learn to hate edge - ever since the last windows update, about half the time, Enter posts replies instead of just adding a new line). Damn, shift enter does it too. Back to chrome. :)

This is what I'm trying, but not very successfully, to post:
View attachment 2237
Nope. The last one is checked "Break on Unhandled Errors".
Should i check the first one?

P.S. About the new line, try shift + enter
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Nope. The last one is checked "Break on Unhandled Errors".
Should i check the first one?
Yes, try the first one.

I have tried shift+enter - it works on some forums, but here it just sends too. Toggling BB code (gear icon) fixes it. It must be an issue with editors - i have a similar experience with WordPress when i use the rich text editor. Fortunately, i don't use it often - mostly just when i need to create a numbered list.
 

soadfan

Member
Outlook version
Outlook 2013 64 bit
Email Account
Office 365 Exchange
So no errors if you are breaking on all errors?
Yep no errors. Actually it worked few times. But other macros are stopping because of an error (like trying to create folder that already exist).

I'm starting to think that may be the problem is in the VBA handler. This is company laptop, part of domain with a lot of restrictions
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Actually it worked few times. But other macros are stopping because of an error (like trying to create folder that already exist).
If it worked before, it should still unless the corp put out a new gpo that blocks macros.

You can check to see if a folder exists:

Dim objNewFolder As Outlook.Folder
Set objNewFolder = objParentFolder.Folders(newFolderName)

If objNewFolder Is Nothing Then
Set objNewFolder = objParentFolder.Folders.Add(newFolderName)
End If
 

soadfan

Member
Outlook version
Outlook 2013 64 bit
Email Account
Office 365 Exchange
Code:
saveFolder = "D:\Desktop\TMP\"
RSubject = Replace(itm.Subject, ":", "_")
RSubject = Replace(RSubject, ",", "_")
RSubject = Replace(RSubject, "/", "_")
RSubject = Replace(RSubject, "\", "_")

MkDir saveFolder
I meant windows directory, not Outlook. If i remember correctly it was such a pain in the *ss to check if folder exist and it's easier just to create it (or at least to try to)
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
I'm not sure its a pita, but you need to use file system object.
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
S Outlook 2010 won't send on Windows 8 Using Outlook 2
R Emails won't come into outlook but can send Using Outlook 0
J Email won't send Automatically in Outlook 2010 Using Outlook 3
I Outlook 2003 won't send emails through one router, but will through another Using Outlook 1
A Outlook won't send emails Using Outlook 1
A Outlook won't send email. Using Outlook 2
B Outlook 2010 won't send or receive after update Using Outlook 4
C Outlook 2007 won't send/revieve posts until some mail is archived Using Outlook 1
D Outlook 2010 won't perform Send/Receive on IMAP folders as scheduled Using Outlook 2
N Multiple errors with Outlook 2010 - Won't receive Hotmail emails; but will send fine. Using Outlook 3
D Outlook 2003 won't send emails to gmail or yahoo addresses Using Outlook 2
W Outlook 2010 won't send mail from 1 account, but i can send it in outlook 2003 Using Outlook 1
P Outlook 2007 won't send email with attachments Using Outlook 2
P 1. Outlook 2007 won't send messages.__ Also:__2. I can't attach a 2nd email address to Outlook 2007. Using Outlook 1
H Outlook 2007 won't send outgoing emails Using Outlook 4
H Outlook Express will receive email, but won't send outsgoing emails. Pls help. Using Outlook 2
T Outlook 2007: outgoing email with addresses taken from address book won't send Using Outlook 9
T Outlook 2007 won't send message with email address that is not in my address book. Using Outlook 2
S Office Outlook 2003 won't send out mail. Using Outlook 1
Paula S. Outlook 2013 won't recognize new password Using Outlook 4
GregS Outlook 2016 iPhone won't download Outlook 2016 Mail. Using Outlook 0
L Outlook Office 365 client: won't remember my setting File, not to collapse ribbon Using Outlook 2
M outlook won't open! Using Outlook 1
P Outlook 2016 won't Start Using Outlook 3
Phil52 Outlook won't work Using Outlook 1
Diane Poremsky Outlook 2013: Control Panel Mail Won't Open New Slipstick.com Articles 0
Diane Poremsky Outlook Links Won't Open In Windows 10 New Slipstick.com Articles 1
L Outlook 2013 won't open MS Office attachments Using Outlook 1
T Outlook 2010 calendar won't sync with Android phone Using Outlook 3
A iPhone Contacts in Outlook won't File As First, Last Using Outlook 0
J Outlook won't open. PST file busy. Using Outlook 3
P Outlook 2007 won't connect Using Outlook 6
R Outlook won't run except in Safe mode problem Using Outlook 5
G Outlook 2003 VBA Won't Run In Outlook 2010 Outlook VBA and Custom Forms 4
M Outlook 2013/365 won't export 99% of my contacts to csv Using Outlook 2
B Add-in "always enabled" but Outlook 13 won't open Using Outlook 7
D Outlook 2013 Categories won't print In color Using Outlook 2
M Outlook 2013 won't convert Excel contacts into Outlook contacts using my custom form Using Outlook 3
C Outlook 2010 Address Book, won't stay selected Using Outlook 5
Z Outlook opens minimized, won't maximize Using Outlook 2
G Outlook 2013 won't download images Using Outlook 6
B Outlook 2010 won't save 'current view' with reading pane at 'bottom' Using Outlook 4
E Outlook 2013 calendar won't sync with iphone 4s Using Outlook 14
B Outlook 2010 won't preview Office attachments Using Outlook 3
B Outlook 2010 asking for password constantly, won't accept correct one Using Outlook 5
J links won't open from Outlook Using Outlook 1
M Outlook 2007 won't respond? Using Outlook 3
C Outlook 2010 won't use a view other than maximized Using Outlook 1
M Outlook Express won't open Using Outlook 1
B Outlook 2010 won't configure exchange account, 0kb .ost file Exchange Server Administration 5
Similar threads


















































Top