我有一个用于加密和解密的Outlook插件,它支持Outlook 2010到2013。
我正在尝试加密电子邮件以解密和显示。
我正在使用通过mailItem_Open函数打开的邮件
wrappedMailItem.Open += new MailItemInspectorOpenDelegate(mailItem_Open);通过此功能,我只需解密电子邮件和内容更新使用
mailItem.HTMLBody = decryptString然后,检查员窗口打开并显示解密邮件。它工作得很好。我关闭了检查器窗口
mailItem_close函数调用
void mailItem_Close(Outlook.MailItem mailItem, ref bool Cancel)
{
try
{
if (mailItem == null)
return;
if (mailItem.Sent != false)
{
var signProperty = GetProperty(mailItem, "App.Decrypted");
// NOTE: Cannot call mailItem.Close from Close event handler
// instead we will start a timer and call it after we
// return. There is a small race condition, but 250
// milliseconds should be enough even on slow machines.
if ((bool)signProperty)
{
var timer = new System.Windows.Forms.Timer { Interval = 250};
timer.Tick += new EventHandler((o, e) =>
{
timer.Stop();
((Outlook._MailItem)mailItem).Close(Outlook.OlInspectorClose.olDiscard);
mailItem = null;
});
Cancel = true;
timer.Start();
}
}
}
catch
{
// Ignore random COM errors
}
Marshal.ReleaseComObject(mailItem);
}问题是
但我没有关闭检查员窗口(显示解密消息),我只是单击前进按钮,它打开了新的检查员窗口,通过查找和转发电子邮件并关闭它。然后我关闭检查器窗口,但父mailItem (即,收件箱邮件)以解密模式显示。在mailItem_close函数中,我只是放弃所有更改,但它不起作用
此问题不会在相同步骤的回复过程中发生,仅在正向情况下发生
请帮帮我
发布于 2015-08-08 00:40:32
与其动态修改消息内容,不如创建自己的表单来显示解密的数据,而不进行设置,并有可能将解密的数据保存在原始消息中。
https://stackoverflow.com/questions/31871474
复制相似问题