Plugin freezing email sending

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

Plugin freezing email sending
 
Sauvik Sarkar




Posts: 3
Joined: 2018-12-01
hi we are experiencing the outlook freezing for ~30 seconds when we capture the email sent event and modify the HTMLBody inside the adxOutlookAppEvents1_ItemSend

We use the addin express library for outlook

we noticed that the freezing is occurring for exchange servers but not for outlook365 servers

Outlook.MailItem mi = (Outlook.MailItem)e.Item;
mi.HTMLBody = = await process(mi.HTMLBody); // process is a async method
mi.Send();

Please help!

Thanks.
Posted 01 Dec, 2018 11:22:29 Top
Andrei Smolin


Add-in Express team


Posts: 16197
Joined: 2006-05-11
Hello Sauvik,

What code line produces the delay?

I don't think Add-in Express can help you solve this issue. I assume the issue occurs due to environment. For instance, does the issue occur if the replaced html is trivial, say, a label? Does your antivirus have any issues that occur at the moment when you replace HTML?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 03 Dec, 2018 05:24:24 Top
Sauvik Sarkar




Posts: 3
Joined: 2018-12-01
Hi Andrei,

Strangely the freezing does NOT occur for outlook365 but only occurs when the mail server is exchange. Do you know if exchange has some kind of a back and forth syncing mechanism for new emails?


Here is the method -

private async void adxOutlookAppEvents1_ItemSend(object sender, ADXOlItemSendEventArgs e)
{

if (e.Item is Outlook.MailItem)
{
Outlook.MailItem mi = (Outlook.MailItem)e.Item;
await SendEmail(mi);
}
}

public async Task SendEmail(Outlook.MailItem mi)
{
string emailbody = mi.HTMLBody;
if (index2 == -1)
{
string formttext = string.Format("<img src='{0}' border='0' width='1' height='1'>", imgLink);
emailbody = emailbody + formttext;
}
else
{
emailbody = emailbody.Insert(index2, string.Format("<img src='{0}' border='0' width='1' height='1'>", imgLink));
}
mi.HTMLBody = emailbody; // this is the spot that is freezing outlook

mi.Send();
}
Posted 03 Dec, 2018 08:33:13 Top
Andrei Smolin


Add-in Express team


Posts: 16197
Joined: 2006-05-11
Hello Sauvik,

Thank you.

Does the issue depend on the HTML code? Would a simple HTML (e.g. showing some short text with no links, images, scripts, whatever) produce the same issue?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 03 Dec, 2018 08:42:53 Top
Sauvik Sarkar




Posts: 3
Joined: 2018-12-01
Hi Andrei,

The issue does not depend on the HTML code, we are anyway just inserting a very simple image link into the body of the html.

Does the code seems fine to you?

We have noticed that this issue occurs for exchange only not outlook365 mail servers do you know of such issues with exchange servers?

Thanks,
Sauvik
Posted 03 Dec, 2018 08:50:23 Top
Andrei Smolin


Add-in Express team


Posts: 16197
Joined: 2006-05-11
Hello Sauvik,

I assume, Oulook365 works with Exchange Online. Anyway, I don't know any practical difference between Exchange or Exchange Online. BTW, is your Exchange an old one?

Could you please confirm that you tried inserting an HTML without an image or link and this produces the same delay?

Also, in your code, there's no need to call send mi.Send(). This is because the event that your code handles in adxOutlookAppEvents1_ItemSend(), occurs right before Outlook sends an Outlook item specified in e.Item. You are expected to modify the email being sent and let it be sent.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 03 Dec, 2018 09:35:52 Top