So a portion of my code contains the following:
Code:
Set OutApp = CreateObject("outlook.application")OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
With OutMail
.SentOnBehalfOfName = IIf(Records![AccountName] = "MAIN", "MAIN@domain.com", "ANYTHING_ELSE@domain.com")
.to = Records![Buyer_Email]
.subject = Email_Subject
.HTMLBody = Body_Format
.Display
.Send
End With
Records.MoveNext
Loop
Set OutMail = Nothing
Set OutApp = Nothing
Everything works great except for the actual sending part. If I take the auto send out I can see each email pop up, all formatted correctly and the "From" address is set correctly depending on the record source. However, I instantly get a bounce back from Outlook stating:
"This message could not be sent. Try sending the message again later, or contact your network administrator. Error is [0x80070005-00000000-00000000]."
Researching, I have to assume all of this is because we don't actually have an Exchange server and are simply using Outlook to organize our Gmail accounts. Looking for someone here to confirm that is my issue as this is the most reliable site I have found.
If this is the case, does anyone know of a method I can take to ensure my messages are being sent from the correct Gmail account within Outlook?