Minty
AWF VIP
- Local time
- Today, 05:25
- Joined
- Jul 26, 2013
- Messages
- 10,355
Hi All,
I have a strange situation that I can't seem to solve. We have staff that generate invoices in an access database that are emailed to end customers.
We would like to send these from the accounts dept email, but the staff concerned only have SentAs permission in Exchange, not permission to access the email account itself.
Lots of reading has led me to try the code below but we are still getting bounce backs with
None of your email accounts could send to this recipient.
As the error message.
The code (important bit) is here;
By all reasonable googling I have tried the
.SentOnBehalfOfName = "accounts@mycompany.com"
should work.
But it don't Any reasonable suggestions entertained.
I can't set From as they would need the accounts account added to their exchange account - which we don't / can't do.
I have a strange situation that I can't seem to solve. We have staff that generate invoices in an access database that are emailed to end customers.
We would like to send these from the accounts dept email, but the staff concerned only have SentAs permission in Exchange, not permission to access the email account itself.
Lots of reading has led me to try the code below but we are still getting bounce backs with
None of your email accounts could send to this recipient.
As the error message.
The code (important bit) is here;
Code:
Set olApp = CreateObject("Outlook.Application")
Set ouNamespace = olApp.GetNamespace("MAPI")
Set olMail = olApp.CreateItem(0)
With olMail
.To = sEmailAddr
.Subject = sEmSubject
' .Body = sEmBody
.HTMLBody = sHTMLEmBody & sHTMLEmSigntr
' .ReplyRecipients.Remove 1
' .ReplyRecipients.Add = "accounts@mycompany.com"
.SentOnBehalfOfName = "accounts@mycompany.com"
.Attachments.Add sEmAttachPath
Select Case nAction
Case 1: ' save in Drafts folder
.Save
Case 2: ' Send immediately
.Send
End Select
End With
.SentOnBehalfOfName = "accounts@mycompany.com"
should work.
But it don't Any reasonable suggestions entertained.
I can't set From as they would need the accounts account added to their exchange account - which we don't / can't do.