Create Mail Sender Object

前端 未结 2 1523
一生所求
一生所求 2021-01-13 02:01

I am creating an Email Object in Outlook 2013, but I cannot find how to create the Sender object. I am using this code:

Outlook.MailItem mail = (Outlook.Mail         


        
2条回答
  •  天涯浪人
    2021-01-13 02:29

    Thanks to Dmitry Streblechenko on his comments above I could get the answer, and these are the lines to create an AddressEntry and assign it to a Sender:

    Outlook.MailItem mail = (Outlook.MailItem) Globals.ThisAddIn.Application.CreateItem(Outlook.OlItemType.olMailItem);
    Outlook.Recipient recipient = Globals.ThisAddIn.Application.Session.CreateRecipient("mymail@domain.com");
    mail.Sender = recipient.AddressEntry;
    

提交回复
热议问题