我一直在试图弄清楚如何通过 C# 将 Outlook 电子邮件发送给多个收件人。现在我可以在收件人之间进行循环,但是我的发件箱中有很多已发送的电子邮件。
Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook.MailItem oMsg = (Microsoft.Office.Interop.Outlook.MailItem)oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
oMsg.HTMLBody ="test";
oMsg.Subject = "test" ;
Microsoft.Office.Interop.Outlook.Recipients oRecips = (Microsoft.Office.Interop.Outlook.Recipients)oMsg.Recipients;
Microsoft.Office.Interop.Outlook.Recipient oRecip = (Microsoft.Office.Interop.Outlook.Recipient)oRecips.Add("xxx@xxx.com");
oRecip.Resolve();
oMsg.Send();
oRecip = null;
oRecips = null;
oMsg = null;
oApp = null;
如果我向它添加多个地址,例如: (Microsoft.Office.Interop.Outlook.Recipient)oRecips.Add("xxx@xxx.com,yyy@yyy.com,zzz@zzz.com") 这不会以某种方式工作。谁可以帮我这个事?