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
 
Nope. It doesn't put it in the outbox at all.
 
You're using an Exchange mailbox in cached mode, right? (Online mode shouldn't even open if offline.)
 
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
 
Security settings weren't changed? (Shouldn't have been, otherwise it would fail manually too.)
 
Add a msgbox as the first line - then restart outlook.

Private Sub Application_Startup()
MsgBox "Sending new message"
Dim objMsg As MailItem
 
Nope. It doesn't work.
Strange thing. Macros are enabled in security settings
 
In the VBA editor, go to tools, options - General tab. Is break on all errors selected?
 
(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
 
(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
 
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.
 
So no errors if you are breaking on all errors?
 
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
 
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
 
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)
 
I'm not sure its a pita, but you need to use file system object.
 
Status
Not open for further replies.
Similar threads
Thread starter Title 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
T Outlook 365 won't take new working password Using Outlook 0
Travis Lloyd Messages Won't Display In Outlook 2019 Home & Business Using Outlook 0
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 Using Outlook 0
Diane Poremsky Outlook Links Won't Open In Windows 10 Using Outlook 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
B outlook 2007 won't play video attachments Using Outlook 3
B Outlook 2003 PST File Won't Compact Using Outlook 1
C Outlook editing won't select just one word Using Outlook 1
D outlook won't open attachments Using Outlook 1
R [outlook-users] Messages won't archive Using Outlook 5
A Outlook 11 for Mac won't print e-mail attachments Using Outlook 6
W Outlook exp. 2007 problems - won't receive new mail Using Outlook 1
J Mail read in OWA won't appear in Outlook Exchange Server Administration 1
D Outlook 2010 won't launch after installin Microsoft office 2010 service pack 1 Using Outlook 1
J Outlook 2010 won't start in Win 7 Using Outlook 4
T Outlook 2003 with multiple explorers won't shutdown Outlook VBA and Custom Forms 2
A Outlook can't remember outlook.com, Exchange password. Using Outlook 0

Similar threads

Back
Top