When trying to send emails using another inbox, I change .SentOnBehalfOfName
to the email I want to send from.
But then the email arrives with "MyRealName on behalf of EmailAddressIWantToSendFrom".
How do I remove MyRealName?
EDIT:
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
To be able to send as that user, you need to have both send-as and receive-as rights. You'd need to connect to that user's mailbox and create the new message in the mailbox of the user you are trying to send as.
EDIT: Try something like the following:
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