'How to set alias as the From account?

I have VBA code in Excel that sends an email via Outlook 365.

My primary email account (@outlook.com) has five aliases. These are not separate email accounts but merely aliases associated with that primary account (which itself is one out of a half a dozen primary accounts). [See attached picture for maybe a better explanation]

I'd like to set one of those aliases as the From address.

This is the relevant snippet; everything else in the Sub, including creating the email and setting the attributes and attachments, works.

Dim emailAlias As String
emailAlias = "[email protected]"

Set Mail_Object = CreateObject("Outlook.Application")
Set Mail_Single = Mail_Object.CreateItem(0)
    
With Mail_Single
     .Subject = Subject
     .To = Cells(cellRow, 2).Value
     .SentOnBehalfOfName = emailAlias     'doesn't work
     .SendUsingAccount = emailAlias       'no go either
     .HTMLBody = msg
     .Attachments.Add fileName
     .Display
End With

Setting the alias as the default account can only be done online at live.com. It would be too cumbersome to (re)set it several times a day, plus it takes Outlook 365 forever to recognize the switch.

Is there a way to specify an alias of a primary account as the From email address?



Solution 1:[1]

Outlook (at least in its current version) would not let you send using one of the proxy SMTP addresses - the message is always sent using the default SMTP address of the account.

You can do that only if you either configure a dummy POP3/SMTP account or use a utility like Proxy Manager (I am its author) - see https://www.msoutlook.info/question/send-mail-from-additional-exchange-address-or-alias for more details.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1