1
Answer

Programmatically sending email using a different Id

Soulshine K

Soulshine K

12y
4.2k
1

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?

Please advise.

Thanks.


Answers (1)