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 關注
- 163 瀏覽
添加回答
舉報