I am sending an email using Outlook
object from a subroutine vba
The email gets send from my email and the recipients see : myemail@xxx.com
. Is there any way I can make those recipients get an email that would have MyfirstName MylastName
instead of my email
Sub Mail_Workbook_1()
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.From = "MyfirstName MylastName" 'something like this
.To = "ron@debruin.nl"
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hello World!"
....
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
If you are sending through Exchange on behalf of another mailbox, set the MailItem.SentOnBehalfOfName
property (assuming you have sufficient privileges)
If you are sending through a particular SMTP account, set the MailItem.SendUsingAccount
property.
If you need to send as an arbitrary SMTP user, see this example - you will essentially need to set the "From" named MAPI property in the PS_INTERNET_HEADERS namespace. Note that not all SMTP servers will let you do that - Exchange for one will not let you spoof the sender.
If you want to send as one of the alias (proxy) SMTP addresses belonging to a particular Exchange mailbox, you will need to send through SMTP - sending through OOM or MAPI will always send with the default SMTP address of the mailbox. For an end user, you can configure a dummy POP3/SMTP account or use a product like Proxy Manager . See MSOutlook.info for more information.
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.