如何在Outlook中附加个人消息作为ATTACHMENT,然后使用C#将其发送给特定的CC接收者?
答案 0 :(得分:0)
你的问题不明确,但我希望这些信息可以帮助你......
请找到以下代码,以便向带有附件的CC收件人发送电子邮件
var oApp = new Microsoft.Office.Interop.Outlook.Application();
var oMsg = (MailItem) oApp.CreateItem(OlItemType.olMailItem);
Recipients oRecips = oMsg.Recipients;
List<string> sCCRecipsList = new List<string>();
sCCRecipsList.Add("CCRecipient1");
sCCRecipsList.Add("CCRecipient2");
sCCRecipsList.Add("CCRecipient3");
Recipients oRecips = oMsg.Recipients;
foreach (string t in sCCRecipsList)
{
Recipient oCCRecip = oRecips.Add(t);
oCCRecip.Type = (int) OlMailRecipientType.olCC;
oCCRecip.Resolve();
}
oMsg.Attachments.Add(@"C:\\fileName.txt", iAttachType, iPosition, sDisplayName);
oMsg.HTMLBody = "Test Body";
oMsg.Subject = "Test Subject";
oMsg.Send();
添加到邮件的CC列表。请参阅以下代码
foreach (string t in sCCRecipsList)
{
Recipient oCCRecip = oRecips.Add(t);
oCCRecip.Type = (int) OlMailRecipientType.olCC;
oCCRecip.Resolve();
}
将txt文件附加到邮件中,请参阅以下代码
oMsg.Attachments.Add(@"C:\\fileName.txt", iAttachType, iPosition, sDisplayName);