2 回答
TA贡献1788条经验 获得超4个赞
根据您的要求,您希望将现有邮件对象作为附件发送到 Outlook 中的另一封邮件。
一种方法是将现有的 mailItem 保存为其他的附件。尝试这个:
private void AddMessageAsAttachment(Microsoft.Office.Interop.Outlook.MailItem
mailContainer,Microsoft.Office.Interop.Outlook.MailItem mailToAttach)
{
Microsoft.Office.Interop.Outlook.Attachments attachments = null;
Microsoft.Office.Interop.Outlook.Attachment attachment = null;
try
{
attachments = mailContainer.Attachments;
attachment = attachments.Add(mailToAttach,
Microsoft.Office.Interop.Outlook.OlAttachmentType.olEmbeddeditem, 1, "The attached e-mail");
mailContainer.Save();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
finally
{
if (attachment != null) Marshal.ReleaseComObject(attachment);
if (attachments != null) Marshal.ReleaseComObject(attachments);
}
}
参考:https ://www.add-in-express.com/creating-addins-blog/2011/08/12/how-to-add-existing-e-mail-message-as-attachment/
TA贡献1891条经验 获得超3个赞
获取邮件,应将其添加为附件。然后调用 «SaveAs({filename}, Microsoft.Office.Interop.Outlook.OlSaveAsType.olMSG)» 并将此文件添加到您的新邮件中
- 2 回答
- 0 关注
- 143 浏览
添加回答
举报