I have 4 accounts set in my Outlook desktop app and I want so send emails preferably from email #4 which is a gmail.
I’ve tried using both SendUsingAccount
and SentOnBehalfOfName
and neither worked.
When I try
With OutlookMail
.SendUsingAccount = OutlookApp.Session.Accounts.Item("[email protected]")
.To = Cells(17, 46).Value
.Subject = "Test Macro"
.Attachments.Add "C:Formação em DadosGrafico e analise Dinamica.pdf"
.Body = "Test"
.Send
End With
The email is sent but from my first or main account set in the app, which is [email protected]. Same thing happens with .Sender
instead of .SendUsingAccount
If I replace (“[email protected]”) for (4) I get an error saying the index is out of range.
If I try SentOnBehalfOfName
, nothing happens, the email isn’t even sent at all.
Important info: I’ve ran a code that reports the index for each account and it only shows the first one. I do have all of them configured in the app.