尝试使用其他收件箱发送电子邮件时,我将.SentOnBehalfOfName
更改为我要发送的电子邮件。
然后,电子邮件以" MyRealName代表EmailAddressIWantToSendFrom"到达。
如何删除MyRealName?
编辑:
Set outlookApp = CreateObject("Outlook.Application")
Set namespace = outlookApp.GetNamespace("MAPI")
namespace.Logon
Set MyItem = outlookApp.CreateItemFromTemplate(path_to_msg_file)
...
pretend that this comment is a bunch of code that modifies the body of MyItem, mostly doing text replacements in MyItem.HTMLBody
...
Set safeItem = CreateObject("Redemption.SafeMailItem")
Set oItem = MyItem
safeItem.Item = oItem
safeItem.To = "person I want to send to"
safeItem.SentOnBehalfOfName = "desired address I want to sent from"
safeItem.Recipients.ResolveAll
safeItem.Send
答案 0 :(得分:1)
为了能够以该用户身份发送,您需要同时拥有send-as和receive-as权限。您需要连接到该用户的邮箱,并在您尝试发送的用户的邮箱中创建新邮件。
编辑: 尝试以下内容:
set rSession = CreateObject("Redemption.RDOSession")
rSession.MAPIOBJECT = Application.Session.MAPIOBJECT
set Store= rSession.GetSharedMailbox("some GAL name")
set Folder = Store.GetDefaultFolder(olFolderOutbox)
set Msg = Folder.Items.Add
Msg.Subejct = "test"
Msg.To = "user@domain.demo"
Msg.Send