Choose the email account when sending emails via VBA

  • Thread starter Thread starter Catalin
  • Start date Start date
C

Catalin

Hi everybody,

As I wrote in an earlier post, I have 3 email accounts and use OL2003.
I have several rules which replies automatically to different senders using
different templates. The problem is that the reply uses the default email
account when sending even though I get the initial email through another
account.

The question is: can I somehow determine the incoming account from the
messages received and then reply automatically through the same account? I
hope this can be done with VBA.

Thanks again in advance for your kind reply.

Catalin
 
To specify the From: field using VBA, you can use the MailItem properties
..SenderEmailAddress or .SenderName. You will first have to get the correct
address by searching your 3 addresses in the To: and Cc: field in the
original email using properties .CC and .To.
 
Both of the properties you mention, along with SenderEmailType are read-only
for the Outlook object model and cannot be set in code.

You can use SentOnBehalfOfName in the Outlook object model.

If you are using Extended MAPI or Redemption (www.dimastr.com/redemption)
you can set SenderName or SenderEmailAddress, but not using the Outlook
object model.
 
And in Outlook 2007 you can use the MailItem.SendUsingAccount property.
 
Back
Top