I have the following code that sends letters to various recipients in a loop
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();
}
However, html just displayed as text with all the tags in the letter, while it was perfect when I used
Outlook.Application oApp = new Outlook.Application();
Outlook.NameSpace oNS = oApp.GetNamespace("mapi");
oNS.Logon(Missing.Value, Missing.Value, true, true);
but I had to go back to the first method, so I can change the address from
Any ideas please?
source
share