简体   繁体   中英

How do I send an email through Outlook - letting the user edit it before sending?

I have an app that collects logging information. I want users to be able to click a button to create an email in Outlook with an attachment containing the logging data they're looking at, and then let them edit the email to put in any additional information, add additional recipients, etc. before they hit send.

I can find plenty of info on automatically creating and sending an email - but nothing on creating the email and then letting the user edit it first.

(I'm happy with an Outlook solution here because it's an internal app and everyone has Outlook).

var outlookApplication = new Application();

var inbox = outlookApplication.GetNamespace("MAPI").GetDefaultFolder(OlDefaultFolders.olFolderInbox);

if (inbox != null)
{
   var email = outlookApplication.CreateItem(OlItemType.olMailItem);
   ...
   email.Display(true);
}

如果您有生成大量电子邮件的过程,则可以将其保存在草稿文件夹中:

email.Move(appOutlook.GetNamespace("MAPI").GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderDrafts))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM