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
 

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.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
D Forwarding email based on the attachment file type and specific text found on the attachment file name Outlook VBA and Custom Forms 0
F Forward incoming email with 4 embedded images in the body without original sender Outlook VBA and Custom Forms 13
W Macro to Filter Based on Latest Email Outlook VBA and Custom Forms 6
D Create advanced search (email) via VBA with LONG QUERY (>1024 char) Outlook VBA and Custom Forms 2
C Outlook 2007 Removing then adding account restores junk email processing Using Outlook 0
G Place jpg in body of email Outlook VBA and Custom Forms 1
F Wishlist Outlook suddenly began synchronizing deleted items every time I delete a single email. Using Outlook 2
N Save Selected Email Message as .msg File Outlook VBA and Custom Forms 12
HarvMan Toggle between calendar and email in Outlook 365 Using Outlook 12
F Email being marked as Spam by Gmail and not being visible in Outlook Using Outlook 5
G Email time stamp Using Outlook 2
G Schedule recurring email and attachments display Outlook VBA and Custom Forms 3
G Save and Rename Outlook Email Attachments Outlook VBA and Custom Forms 0
B Need to Copy an email to a subfolder Outlook VBA and Custom Forms 2
M How to setup outlook after importing old account information - Entering email account info creates with "(1)" after the account! Using Outlook 1
K Multiple Rules on Single Email Using Outlook 2
F VBA to move email from Non Default folder to Sub folders as per details given in excel file Outlook VBA and Custom Forms 11
e_a_g_l_e_p_i Outlook 2010 How to set default email address for website links Using Outlook 3
O Same email address, same person, names in so many ways Using Outlook 4
D Create new email from the received Email Body with attachment Outlook VBA and Custom Forms 10
D Outlook launch email showing new unread email in reading pane Using Outlook 11
B Zoom automatically next email item (VBA) Outlook VBA and Custom Forms 2
K Outlook adds space to rows in HTML email signatures viewed on mobile Using Outlook 1
M HTML email signature in Outlook Using Outlook 3
M Respond to Outlook Email Outlook VBA and Custom Forms 0
U Outlook locking up when replying to Email Using Outlook 7
S Email Generated from another program and then edited sends original email. Using Outlook 2
G Forward email body to other mail list directly from Exchange server Exchange Server Administration 1
S Unable to extract text from an Outlook email message Using Outlook 2
T Original email text not shown when replying or forwarding the email. Using Outlook 6
H Search Email Header for Content Type Outlook VBA and Custom Forms 1
A VBA Script - Print Date between first email in Category X and last email in Category Y Outlook VBA and Custom Forms 3
R Problem moving file “Email folders.pst” to new PC Using Outlook 5
P Sending email from outlook IMAP to GMAIL where embedded images are added as attachment Using Outlook 1
D auto forward base on email address in body email Outlook VBA and Custom Forms 0
P How did hacker cause link to delete and archive containing email? Using Outlook 6
I 'quote marks' around email name Using Outlook 1
N contact list seen in Contact folder but knot in Address book or when 'TO' button is clicked in new email Using Outlook 0
T Junk Email does not get added to the Blocked Sender List Using Outlook 0
P i-Phone 6s Plus receiving 2 notifications from Outlook email Using Outlook 1
C WARNING - DO NOT USE AN OUTLOOK.COM ADDRESS FOR GOOGLE ACCOUNT RECOVERY EMAIL Using Outlook 10
T Why is every new email pinned (to keep it on top)? Windows 10 Using Outlook 6
M Outlook, send to > mail recipient - results in plain text email Using Outlook 1
P Can I create a Rule that sends me an email when I get a Task? Using Outlook 2
M Issue transferring Outlook 2016 email accounts & settings onto new computer Using Outlook 8
R Auto Assign Category colours to Incoming Emails based on whom the email is addressed Outlook VBA and Custom Forms 3
S Outlook email to configure setup for each mail Outlook VBA and Custom Forms 1
S Macro to extract email addresses of recipients in current drafted email and put into clipboard Outlook VBA and Custom Forms 2
A Is there an ID field you can use to pair a reply to the sent email? Outlook VBA and Custom Forms 4
C Auto Run VBA Code on new email Outlook VBA and Custom Forms 1

Similar threads

Top