How to send a mail using Microsoft.Office.Interop.Outlook.MailItem by specifying the From Address

You are using outlook to send the mail. Since outlook must be configured to use the from address of your mail, you cannot provide the from address directly. However, you can select an account available on outlook. For example :

using Outlook = Microsoft.Office.Interop.Outlook;

Outlook.Accounts accounts = olkApp1.Session.Accounts;
foreach (Outlook.Account account in accounts)
{
    // When the e-mail address matches, send the mail.
    if (account.SmtpAddress == "[email protected]")
    {
            olkMail1.SendUsingAccount = account;
            ((Outlook._MailItem)olkMail1).Send();
            break;
    }
}

Leave a Comment