当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - Programmatically sending email using a different Id

问题描述:

Using outlook API, am able to send email without setting any sender's email Id.

Heres my C# code:

Outlook.Application oApp = new Outlook.Application();

Outlook.MailItem email = (Outlook.MailItem)(oApp.CreateItem(Outlook.OlItemType.olMailItem));

email.Recipients.Add("[email protected]");

//email.Sender.Address = "[email protected]";

email.Subject = "TestSubject";

email.Body = "TestBody";

((Outlook.MailItem)email).Send();

If I want to send this mail using a different email Id, say [email protected], what do I need to do?

Do I need to use email.Sender.Address = "[email protected]";?

Please advise.

Thanks.

分享给朋友:
您可能感兴趣的文章:
随机阅读: