Commit c2fdc390 authored by Thomas's avatar Thomas
Browse files

Make sure we have a mail item to show if an error occurs during sending.

parent 981e1624
......@@ -2151,39 +2151,39 @@ namespace pEp
Outlook.MailItem sendItem = null;
try
{
if (sendError == false)
/* If we have an entry id at this point, we are trying to send a message that has been saved during composing and is probably
* stored in the pEp Drafts folder. In this case, get a new handle on the mail item to prevent the "The operation cannot be performed
* because the message has been changed" error during sending.
*/
string eid = omi.EntryID;
if (string.IsNullOrEmpty(eid))
{
/* If we have an entry id at this point, we are trying to send a message that has been saved during composing and is probably
* stored in the pEp Drafts folder. In this case, get a new handle on the mail item to prevent the "The operation cannot be performed
* because the message has been changed" error during sending.
*/
string eid = omi.EntryID;
if (string.IsNullOrEmpty(eid))
sendItem = omi;
}
else
{
Outlook.Application application = null;
Outlook.NameSpace session = null;
try
{
application = Globals.ThisAddIn.Application;
session = application.Session;
sendItem = session.GetItemFromID(eid);
}
catch (Exception ex)
{
sendItem = omi;
Log.Error("ProcessAndSendMessageAsync: Error getting send item. " + ex.ToString());
}
else
finally
{
Outlook.Application application = null;
Outlook.NameSpace session = null;
try
{
application = Globals.ThisAddIn.Application;
session = application.Session;
sendItem = session.GetItemFromID(eid);
}
catch (Exception ex)
{
sendItem = omi;
Log.Error("ProcessAndSendMessageAsync: Error getting send item. " + ex.ToString());
}
finally
{
application = null;
session = null;
}
application = null;
session = null;
}
}
if (sendError == false)
{
// OUT-713: Prevent second "Empty subject" warning
if (string.IsNullOrEmpty(processedMessage.ShortMsg))
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment