Outlook automation – Change Sender Account

automationoutlook

I'm automating Outlook and I need to control who the email appears to be from. The users will have two or more Accounts set up in Outlook and I need to be able to select which account to send the email from. Any ideas?

Needs to be supported on Outlook 2003 and above. I'm using Delphi 2006 to code this, but that doesn't really matter.

Best Solution

A person named Sue Mosher wrote up a pretty summary on this issue in microsoft.public.office.developer.outlook.vba.

In short, it boils down to either of this:

  • use MailItem.SentOnBehalfOfName, which only works in Exchange enviromnents (I suppose that is the case for you) - when the user has "Send As" permissions for the other Exchange mailbox, this is pretty much the same thing as switching accounts.
  • use a small hack that involves fiddling with the CommandBars
  • use Outlook Redemption
  • (in OL2007, you would have MailItem.SendUsingAccount)
Related Question