VSTO发送自定义电子邮件

时间:2020-09-22 11:17:22

标签: c# email outlook vsto

用户创建新电子邮件,然后单击“发送”按钮,邮件丢失,并且附加组件使用相同的TOCCBCCsubject创建新电子邮件, AttachmentHTMLBody

和HTMLBody将通过一些文本进行修改。

我的问题是如何从用户的新电子邮件中访问所有值。

 public void SendNewEmail( object Item, ref bool Cancel)
 {
     Outlook.MailItem newMailItem = Application.CreateItem(Outlook.OlItemType.olMailItem);
     newMailItem.To = ;
     newMailItem.Subject = ;
     newMailItem.Attachment = ;
     newMailItem.HTMLBody = ;
     
     newMailItem.Send(); 
  }

更新我

对吗?

public void SendNewEmail(object Item, MailSendType SendType)
    {
        Outlook.MailItem newMailItem = Application.CreateItem(Outlook.OlItemType.olMailItem);
        Outlook.MailItem mItem = Item as Outlook.MailItem;
        
        newMailItem.To = mItem.To;
        newMailItem.Subject = mItem.Subject;
        newMailItem.HTMLBody = mItem.HTMLBody;

        newMailItem.Send();
    }

private void Application_ItemSend(object Item, ref bool Cancel)
{
      SendNewEmail(Item, MailSendType.Normal);  
}

0 个答案:

没有答案