我有以下代码循环发送电子邮件给不同的收件人
public void SendMail2(string subject, string body, string emailAddress, string cc)
{
Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook.MailItem mailItem = app.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
mailItem.Subject = subject;
mailItem.To = emailAddress;
mailItem.CC = cc;
mailItem.Body = body;
mailItem.SentOnBehalfOfName = "name";
mailItem.Display(false);
mailItem.Send();
}
但是 html 只是显示为带有电子邮件中所有标签的文本,而当我使用时它是完美的
// Create the Outlook application.
Outlook.Application oApp = new Outlook.Application();
// Get the NameSpace and Logon information.
Outlook.NameSpace oNS = oApp.GetNamespace("mapi");
// Log on by using a dialog box to choose the profile.
oNS.Logon(Missing.Value, Missing.Value, true, true);
但我不得不恢复到第一种方法,这样我才能更改“发件人”地址
有什么想法吗?
最佳答案
关于c# - HTML 未显示在 outlook 邮件中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29373676/