Delayed emails not getting sent

Add-in Express™ Support Service
That's what is more important than anything else

Delayed emails not getting sent
 
Ben Cowling


Guest


I'm having an issue with an Outlook addin when emails have been set to have a delay before sending. To configure the delay I followed these steps:

https://support.office.com/en-gb/article/Delay-or-schedule-sending-email-messages-253dbfd7-0db7-4f41-bcc5-9e8e68ae29bf

It looks to be similar to this post:

https://www.add-in-express.com/forum/read.php?FID=1&TID=5081&MID=25312#message25312

I don't quite understand the possible workaround described and if this is still valid in later versions. Have you any guidance on preventing this from happening.

The addin doesn't even touch any emails, only calendar and contacts so not sure why this is happening.
Posted 18 Jan, 2017 04:31:09 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hello Ben,

Reading most properties on an email stored in the Outbox makes the email non-sendable. To prevent this, you need to make sure that the Outlook.MAPIFolder object returned by MailItem.Parent does not point to an Outbox folder.

This is what Dmitry said in that topic. Is this what you are looking for?


Andrei Smolin
Add-in Express Team Leader
Posted 18 Jan, 2017 04:49:25 Top
Ben Cowling


Guest


Andrei

We are not accessing that property in the Add-In. What I have just noticed is that we do handle the adxOutlookEvents_ExplorerSelectionChange event.

private void adxOutlookEvents_ExplorerSelectionChange(object sender, object explorer)
{
Outlook.Selection selection = null;
Outlook.ContactItem contactitem = null;
try
{
selection = (explorer as Outlook.Explorer).Selection;
if (selection.Count > 0)
contactitem = (selection[1] as Outlook.ContactItem);
}
catch { }
finally
{
if (selection != null) Marshal.ReleaseComObject(selection);
}
if (contactitem != null)
{
contact = contactitem;
}
}

This looks to be the cause of the problem. As we are only interested in the selected Contact not mail items, is there anyway to prevent this from happening?

Regards

Ben
Posted 18 Jan, 2017 04:54:04 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Ben,

Yes. You need to prevent accessing the selected item if the current folder is an Outbox folder.


Andrei Smolin
Add-in Express Team Leader
Posted 18 Jan, 2017 05:14:54 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hmmm. I should have said "I believe, yes" instead of just "Yes".


Andrei Smolin
Add-in Express Team Leader
Posted 18 Jan, 2017 05:15:52 Top
Ben Cowling


Guest


Thanks, this workaround stops this from happening.
Posted 18 Jan, 2017 05:34:10 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Great!

You need to check all of the Outbox folders in the profile: for each Outlook.Store, you get such a folder using Store.GetDefaultFolder(...).


Andrei Smolin
Add-in Express Team Leader
Posted 18 Jan, 2017 05:43:15 Top
Ben Cowling


Guest


Thanks, I actually changed it to check what the DefaultItemType was. So I think this should work ok.

var exp = explorer as Outlook.Explorer;
if (exp.CurrentFolder.DefaultItemType != Outlook.OlItemType.olContactItem)
{
return;
}
Posted 18 Jan, 2017 05:47:13 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Well, if this works for you.


Andrei Smolin
Add-in Express Team Leader
Posted 18 Jan, 2017 06:21:27 Top