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

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
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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.
 

Oprocon

New Member
Outlook version
Outlook 2019 32-bit
Email Account
Outlook.com (as MS Exchange)
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?
 

Oprocon

New Member
Outlook version
Outlook 2019 32-bit
Email Account
Outlook.com (as MS Exchange)
Diane??? Nothing??? Ok, thanks.
 
Thread starter Similar threads Forum Replies Date
glnz O365 - How to combine the Inboxes for four email accounts into a single Inbox Using Outlook 7
glnz O365 - How to send from acct 2 but showing email name from acct 1 as From - alias? Using Outlook 1
S Macro to move “Re:” & “FWD:” email recieved the shared inbox to a subfolder in outlook Outlook VBA and Custom Forms 0
D Move Email with Attachment to Folder Outlook VBA and Custom Forms 3
E Asking user to select multiple options in a list in an email Outlook VBA and Custom Forms 0
K Use VBA to find Sender and Recipient from Microsfot 365 Journaled Email Items Outlook VBA and Custom Forms 3
B Add ComboBox Value to Body of Email Outlook VBA and Custom Forms 1
A Backup Email Accounts On OutLook For Mac 2016 (Microsoft 365 subscription version) Using Outlook 0
F VBA code to dock Styles whenever I write or edit an email Outlook VBA and Custom Forms 0
G Inbox shows old email Using Outlook 3
L Email with correct To address but displaying name of a related person Using Outlook 0
A Two Inboxes, Same Email? Using Outlook 3
B Adding signature to bottom of VBA reply email Outlook VBA and Custom Forms 1
J To delete the draft email Using Outlook 2
B VBScript doesn't run on Recipient Email Outlook VBA and Custom Forms 2
J Autoreply email recieved from specific sender after deleting some text from body. Using Outlook 0
M Outlook 2013 reminder email by using Outlook vba Outlook VBA and Custom Forms 2
D Sending email from Office 365 alias in Outlook Using Outlook 3
S Macro or plug-in to see if specific person was included in this email Outlook VBA and Custom Forms 3
S Body text of Email from invite date/time Outlook VBA and Custom Forms 7
R Outlook 2010 How do you export 2 email Accounts' 2010 Inbox Files to new computer (2019)? Using Outlook 0
R Auto display of new email does not work on non-default account Outlook VBA and Custom Forms 0
J Automatically forward email and apply template Outlook VBA and Custom Forms 0
L Outlook saved email templates Using Outlook 1
B VBA to convert email to task, insert text of email in task notes, and attach copy of original email Outlook VBA and Custom Forms 4
T How can you include Junk Email in Search Results like you can include Deleted Items? Using Outlook 3
B Extracting email addresses from a folder - how to also get the name of the person the address is for? Using Outlook 5
W Replyin to the reply-to email address Outlook VBA and Custom Forms 0
E How to display "Change Folder" in Change Default Email Delivery Location in Exchange Outlook 2016 Using Outlook 1
M Extract all links from Outlook email, send to Excel Using Outlook 2
O Forward a email with modified body Automatically. Outlook VBA and Custom Forms 0
B Outlook 2003 email sending & receiving suddenly stopped working Using Outlook 3
R List folders in a combo box + select folder + move emails from inbox to that folder + reply to that email Outlook VBA and Custom Forms 1
T The non-email functions Using Outlook 8
P Outlook 2013 Word Share doc as Email Attachment now brings up Eudora. Using Outlook 1
C How to rename subject line and forward the email Outlook VBA and Custom Forms 2
R Help Revising VBA macro to delete email over different time span Outlook VBA and Custom Forms 0
J Sent Items Folder NOT Showing Correct From Email Address Using Outlook 0
J Outlook Reply > From > Other Email Address... > Address Not Showing in Sent Items... From Email Outlook VBA and Custom Forms 0
T Column to display which email alias a message was sent to Outlook VBA and Custom Forms 6
Marc2019 Need help please! Cannot Setup my outlook email account on my Mac Outlook 2011 Using Outlook.com accounts in Outlook 2
HarvMan Hotmail - Sending email is undeliverable Using Outlook 4
R Error when trying to forward current email item Outlook VBA and Custom Forms 7
H In outlook 365 POP mail Inbox, email takes a long time or never arrives. Using Outlook 1
D Can Exchange Admin Center create a pst for users email/contacts/calendar? Exchange Server Administration 0
T After I send a new email, it remains in the Draft folder Using Outlook.com accounts in Outlook 3
P OWA Settings->Calendar->Events from Email; Setting changes do not hold Using Outlook 1
S How to export urls from email to excel and check the status of the url ? New Slipstick.com Articles 6
P Auto Insert Current Date or Time into Email Subject Outlook VBA and Custom Forms 2
S Change VBA script to send HTML email instead of text Outlook VBA and Custom Forms 3
Similar threads


















































Top