[英]Is there an easy way to convert from Microsoft.Office.Interop.Outlook.MailItem to System.Net.Mail.MailMessage?
The title pretty much says it all. 标题基本概括了所有内容。 I have an Outlook interop
MailItem
. 我有一个Outlook互操作
MailItem
。 I'd like to create a System.Net.Mail
MailMessage
from the MailItem
, modify a few properties (such as the sender), and then send it. 我想从
MailItem
创建一个System.Net.Mail
MailMessage
,修改一些属性(例如发件人),然后发送它。 Is this something that must be done manually, or do either of these libraries (or a third party library) provide a simple way to achieve this? 这是必须手动完成的事情,还是这些库(或第三方库)提供了一种简单的方法来实现?
MailItem
from Outlook and MailMessage
from the .NET Framework are very different things. Outlook中的
MailItem
和.NET Framework中的MailMessage
是非常不同的东西。
You need to do a lot of work manually: 您需要手动完成很多工作:
MailMessage
. MailMessage
创建新的正文。 MailItem
using temporary files or memory streams. MailItem
获取并存储附件。 MailMessage
using stored data from the previous point. MailMessage
创建新附件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.