简体   繁体   中英

Sending from secondary email account in outlook

I have an excel spreadsheet with some VBA that will send a marketing email to everyone with an email address in a spreadsheet.

When I send it through my main account it works absolutely perfectly but when I try to send it through our 'marketing@' email account, it only sends back to that account.

The emails send from my account (correctly) and appear in my sent items and when they are received in the marketing@ account, the reply address is marketing@ so everything appears to be working. It is just not sending to the recipient.

I have permission to SendAs in Exchange and this works (if I try a different address I get an access denied error message) but cannot work out why this isn't working for me at all.

This is my code:

 Private Sub StackOverflow()
  Dim OlApp As Outlook.Application
  Dim olMail As Outlook.MailItem

    Set OlApp = New Outlook.Application
    Set olMail = OlApp.CreateItem(olMailItem)
    With olMail
      .SentOnBehalfOfName = """Marketing"" <marketing@>"
      .To = "Recipient"
      .Subject = "Test"
      .Body = "Test"
      .Display
    End With

  Set olMail = Nothing
  Set OlApp = Nothing
End Sub

What changes I need to make to this code to get it to send to the recipient and not back to the account I'm sending from?

This has now been solved and it's nothing to do with Excel or Outlook.

It seems that somehow, a rule was placed on the server that re-routed anything sent from this account to the account instead. Now this rule has been removed, the code works perfectly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM