I'm working on an Outlook Add in, and I want to look for some specific tags in the html of the mail that the user is reading. For that matter, I'm using the ActiveExplorer's Selection change event.

currentExplorer.SelectionChange += new Outlook

.ExplorerEvents_10_SelectionChangeEventHandler

(CurrentExplorer_Event);

private void CurrentExplorer_Event()

if (this.Application.ActiveExplorer().Selection.Count == 1)

Object selObject = this.Application.ActiveExplorer().Selection[1];

if (selObject is Outlook.MailItem)

Outlook.MailItem mailItem = (selObject as Outlook.MailItem);

lookForTags(mailItem.HTMLBody);

The problem is that for it to work the user has to click on the mail item twice because the first time, mail is still loading and and mailItem.HTMLBody returns this:

Then the second time, mail is done loading so mailItem.HTMLBody returns the real body and everything works fine. Is there any other event that is fired when the mail is done loading so that I can start executing my code? Or is there a better solution to avoid having an empty HTMLBody?

I'm working on an Outlook Add in, and I want to look for some specific tags in the html of the mail that the user is reading. For that matter, I'm using the ActiveExplorer's Selection change event.cur...
本文将详细介绍如何使用 C# 和VB.NET中的Spire.Email发送带有 HTML 正文的电子 邮件 。 Step 1:创建MailMessage类的实例,并在其构造函数中指定发件人和收件人。 MailAddress addressFrom = new MailAddress(“jack.du@e - iceblue.com”,“Jack Du”); MailAddress addressTo = n...
使用QQ作为发起端: // System.Net.Mail.MailMessage myMail = new System.Net.Mail.MailMessage(); // myMail.From = new System.Net.Mail.MailAddress("839599321@qq.com"); //发送者,要和 邮件 服务器的验证信息对应,不能随便更改 // //myMail.Fro...
读取 邮件 const string PROPERTY_NAME_EMAILL = "oldMail";//标记 邮件 是否读取 private static void ReadEmail() Outlook .Application app = new Outlook .Application(); Outlook .NameSpace ns = app.GetNamespace("MAPI");
各位大神好。初学VBA,看了一个多礼拜的自学视频,又花了四五天时间想做出一个在报表里自动发 邮件 的小程序 试了很多 也在网上找了许多案例 但是最后效果 outlook 中显示出附件图片而没有图片附件,收件后则是有图片附件,正文中图片全白无法显示,解决如下: Dim newMlItem As Outlook . MailItem ms = "C:\Users\temp\Desktop\捕获.PNG" FileName = "捕获.PNG" Set newMlItem = Outlook .Create...
outlook = win32.Dispatch(' Outlook .Application') mail_item = outlook .CreateItem(0) # 0: ol MailItem mail_item.Recipien...
您可以使用 Microsoft Outlook 的 COM 组件来实现这个功能。首先,您需要在 C# 中添加对 Microsoft Outlook 的引用。然后,您可以使用以下代码从 邮件 正文中提取信息: ```csharp using Outlook = Microsoft.Office.Interop. Outlook ; // 获取当前选中的 邮件 Outlook .Application outlook App = new Outlook .Application(); Outlook . MailItem mailItem = outlook App.ActiveExplorer().Selection[1] as Outlook . MailItem ; // 从 邮件 正文中提取信息 string body = mailItem . Body ; string info = ""; // 存储提取的信息 // 在正文中查找关键字 int start = body .IndexOf("关键字1:"); if (start != - 1) start += "关键字1:".Length; int end = body .IndexOf("\n", start); info = body .Substring(start, end - start); // 如果第一个关键字不存在,查找第二个关键字 start = body .IndexOf("关键字2:"); if (start != - 1) start += "关键字2:".Length; int end = body .IndexOf("\n", start); info = body .Substring(start, end - start); // 输出提取的信息 Console.WriteLine(info); 请注意,您需要根据您的具体需求修改代码中的关键字和提取信息的方式。