Email not leaving Outbox when using Excel VBA to sync Outlook account

Status
Not open for further replies.

Oprocon

New Member
Outlook version
Outlook 2019 32-bit
Email Account
Outlook.com (as MS Exchange)
Hi everybody, I've just joined this forum - thanks for having me and I need some of your expertise, if you don't mind...

My situation:
I have a single outlook.com exchange account added to Outlook 2019. By default, when I go into Send/Receive Groups, All Accounts, Edit..., the tickbox for "Include the selected account in this group" is UNTICKED. However, I have no problem sending and receiving emails when I press F9 (I have "Send immediately when connected" unticked). So, even though I don't really understand why my emails send and receive despite that account not being in the All Accounts Send/Receive Group, I'm not worried because normal F9 send/receive seems to work ok for me anyway.

Now, I've written some code in Excel to automatically generate and send an email through my Outlook account and I use GetNamespace("MAPI").SyncObjects to initiate the sync process (i.e. simulating a manual F9 press). If I change "Include the selected account in this group" to TICKED, the email sends as it should and ends up in the Sent Items folder. All good...

My problem:
I need to be able to deploy my Excel-based macro across a number of unattended computers which have "Send immediately when connected" unticked and which have the default email account UNTICKED in "Include the selected account in this group" (just like the setup on my own computer).
However, If I run my Excel macro with "Include the selected account in this group" UNTICKED, SyncObjects has no effect and the email gets stuck in the Outbox until I press F9 manually. So, this leads me to conclude that SyncObjects doesn't really do the same thing as F9.

My questions:
  1. Is there a way, programatically, to 'finish sending' any emails stuck in the Outbox which didn't get sent by SyncObjects because they were from an account that's not included in a Send/Receive Group and "Send immediately when connected" is unticked? Maybe some sort of purge method?
  2. Is there another way to fully send an email programatically that uses a different method to SyncObjects and which isn't impacted by whether or not the account is part of a Send/Receive Group?
I really appreciate you reading this and, if you have any ideas, I would be most grateful indeed! Many thanks... Oprocon
 
By default, when I go into Send/Receive Groups, All Accounts, Edit..., the tickbox for "Include the selected account in this group" is UNTICKED.
This is normal for Exchange accounts - the send/receive settings do not apply to Exchange accounts. With exchange you are constantly syncing unless you have outlook set to work offline.

As for your questions, i will need to test a few things.
 
Diane, thank you for explaining the Exchange syncing principle - I hadn't realised that!

i will need to test a few things
Would it help you if I uploaded an Excel file containing the code I've been using, for demo purposes?
 
Diane??? Nothing??? Ok, thanks.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
M Outlook 365 adding standard message in body of template email Outlook VBA and Custom Forms 3
E Create Rule to Forward Email if Subject Begins With Using Outlook 2
V iCloud For Windows v15.x - Missing Email Features ? Using Outlook 4
M Thunderbird email client - I wonder Using Outlook 1
D Outlook Desktop App Email Software Using Outlook 0
P Email and calendar entry text now shifts right about 3 tabs worth of space Using Outlook 1
J Outlook macro to run before email is being send Outlook VBA and Custom Forms 0
T Outlook 2010 Creating a email 'Group' in OL 2010 Using Outlook 2
D Send email from Outlook Alias using Mac? Using Outlook 0
T How to set Default FONT for Email composing ? Using Outlook 0
H Finding text in open email Outlook VBA and Custom Forms 12
T Why do Outlook Desktop 2021 tasks from my wife's email show up in my task pane? Using Outlook 2
A Opening a link from an email automatically Outlook VBA and Custom Forms 0
D Outlook 2021 New email reminder Using Outlook.com accounts in Outlook 1
Rupert Dragwater How do I remove an email ending with @gmail.com Using Outlook 4
M A plug in (or method) to keep email message formatting after it expires Using Outlook 1
L VBA to Triage Incoming Email Outlook VBA and Custom Forms 0
R Legacy Outlook on Mac Email Cache Using Outlook 0
P Email address auto-completes work fine on laptop, but no longer on desktop Using Outlook 3
S Create Outlook Task from Template and append Body with Email Body Outlook VBA and Custom Forms 4
H Copying email address(es) in body of email and pasting in To field Outlook VBA and Custom Forms 1
A Search folder and move the email Outlook VBA and Custom Forms 0
P VBA to add email address to Outlook 365 rule Outlook VBA and Custom Forms 0
farrissf Outlook 2016 Optimizing Email Searches in Outlook 2016: Seeking Insights on Quick Search vs Advanced Search Features Using Outlook 0
D Delete selected text in outgoing email body Outlook VBA and Custom Forms 0
F Graphics in email / Mac recipient garbled Using Outlook 0
D Outlook VBA forward the selected email to the original sender’s email ID (including the email used in TO, CC Field) from the email chain Outlook VBA and Custom Forms 2
Witzker Outlook 2019 Macro to seach in all contact Folders for marked Email Adress Outlook VBA and Custom Forms 0
E Outlook 365 Save Selected Email Message as .msg File - oMail.Delete not working when SEARCH Outlook VBA and Custom Forms 0
S Email Macros to go to a SHARED Outlook mailbox Draft folder...NOT my personal Outlook Draft folder Using Outlook 2
R Outlook 365 VBA AUTO SEND WITH DELAY FOR EACH EMAIL Outlook VBA and Custom Forms 0
G Print email attachments when hit subfolder Outlook VBA and Custom Forms 1
C Spam Email? Using Outlook 2
G Automatically delete email when a condition is met Outlook VBA and Custom Forms 1
E Save Selected Email Message as .msg File - digitally sign email doesn't works Outlook VBA and Custom Forms 1
S Email was migrated from GoDaddy to Microsoft exchange. We lost IMAP ability Exchange Server Administration 1
R Outlook 365 How to integrate a third-party app with Outlook to track email and sms? Using Outlook 2
S Paperclip icon shows without attachment in email under Sent folder Using Outlook 0
B Outlook 2019 Automatically move email after assigning category Using Outlook 4
Rupert Dragwater How to permanently remove an email address Using Outlook 9
K vba code to auto download email into a specific folder in local hard disk as and when any new email arrives in Inbox/subfolder Outlook VBA and Custom Forms 0
F Auto changing email subject line in bulk Using Outlook 2
F Want to add second email to Outlook for business use Using Outlook 4
kburrows Outlook Email Body Text Disappears/Overlaps, Folders Switch Around when You Hover, Excel Opens Randomly and Runs in the Background - Profile Corrupt? Using Outlook 0
J Outlook 365 Outlook Macro to Sort emails by column "Received" to view the latest email received Outlook VBA and Custom Forms 0
A Outlook 2019 Help with forwarding email without mentioning the previous email sender. Outlook VBA and Custom Forms 0
J Macro to send email as alias Outlook VBA and Custom Forms 0
M Shift Delete doesn't delete email from server Using Outlook 3
K Incorporate selection from combobox into body of email Outlook VBA and Custom Forms 0
L Why are some email automatically going to "archive" Using Outlook 2

Similar threads

Back
Top