用附件撰写Outlook中的电子邮件

在我的应用程序中,我有一个要求,即如果用户点击发票编号,生成的发票声明将附加到outlook中的撰写电子邮件中。 使用下面的代码我能够发送自动电子邮件,但我需要撰写并打开Outlook窗口供用户查看和编辑内容。 不要寄。 请帮助。

public void pdfStatement(string InvoiceNumber) { InvoiceNumber = InvoiceNumber.Trim(); string mailServer = "server"; string fileName = InvoiceNumber; string filePath = Server.MapPath("~/Content/reports/"); string messageBody = "Its an automated test email, please ignore if you receive this."; CreateMessageWithAttachment(mailServer, filePath, fileName, messageBody); } public void CreateMessageWithAttachment(string mailServer, string filePath, string fileName, string messageBody) { MailMessage message = new MailMessage ( "user@domain.com", "user@domain.com", "TestEmail", messageBody); filePath = filePath + fileName + ".pdf"; // Create the file attachment for this e-mail message. Attachment attach = new Attachment(filePath); attach.Name = fileName + ".pdf"; // Add the file attachment to this e-mail message. message.Attachments.Add(attach); //Send the message. SmtpClient client = new SmtpClient(mailServer); var AuthenticationDetails = new NetworkCredential("user", "password"); client.Credentials = AuthenticationDetails; client.Send(message); } 

不确定这是否会有所帮助,但是如何在页面中创建表单并允许用户键入/查看他们发送的内容。 这里有样品

预览按钮也可以提供帮助

编辑:然后你需要使用Microsoft.Office.Interop.Outlook命名空间来创建一个邮件项目。
这是第一个样本
从示例中,MailItem类(oMsg)还有一个Display()方法,该方法应显示创建的电子邮件。
第二个示例(ASP.NET版本)