vba 如何在 Outlook 中更改发件人姓名?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23376859/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to change sender name in Outlook ?
提问by Buras
I am sending an email using Outlook
object from a subroutine vba
我正在使用Outlook
子程序中的对象发送电子邮件vba
The email gets send from my email and the recipients see : [email protected]
. Is there any way I can make those recipients get an email that would have MyfirstName MylastName
instead of my email
电子邮件从我的电子邮件发送,收件人看到:[email protected]
。有什么办法可以让这些收件人收到一封电子邮件,MyfirstName MylastName
而不是我的电子邮件
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 = "[email protected]"
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hello World!"
....
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
回答by Dmitry Streblechenko
If you are sending through Exchange on behalf of another mailbox, set the MailItem.SentOnBehalfOfName
property (assuming you have sufficient privileges)
如果您代表另一个邮箱通过 Exchange 发送,请设置该MailItem.SentOnBehalfOfName
属性(假设您有足够的权限)
If you are sending through a particular SMTP account, set the MailItem.SendUsingAccount
property.
如果您通过特定的 SMTP 帐户发送,请设置该MailItem.SendUsingAccount
属性。
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.
如果您需要以任意 SMTP 用户的身份发送,请参阅此示例- 您基本上需要在 PS_INTERNET_HEADERS 命名空间中设置名为“From”的 MAPI 属性。请注意,并非所有 SMTP 服务器都允许您这样做 - Exchange for one 不会让您欺骗发件人。
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.infofor more information.
如果要作为属于特定 Exchange 邮箱的别名(代理)SMTP 地址之一发送,则需要通过 SMTP 发送 - 通过 OOM 或 MAPI 发送将始终使用邮箱的默认 SMTP 地址发送。对于最终用户,您可以配置一个虚拟 POP3/SMTP 帐户或使用诸如Proxy Manager 之类的产品。有关详细信息,请参阅MSOutlook.info。