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:
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:
- 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?
- 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?