将个人信息作为附件发送并发送给特定的cc,以便其他CC / TO / BCC无法看到该附件

时间:2014-06-17 06:05:47

标签: email outlook outlook-addin

如何在Outlook中附加个人消息作为ATTACHMENT,然后使用C#将其发送给特定的CC接收者?

1 个答案:

答案 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);