Send mail with specific mailbox defaults from Outl

2019-09-09 06:04发布

问题:

With multiple email account Mailboxes attached to one Outlook client, how can I choose one of the Mailboxes (in code) and generate and send a MailItem that has all the default characteristics of that Mailbox, such as the default signature, reply-to address, priority etc. etc.

Is there a way to do that easily using VBA? By easily, I mean how can it be done without explicitly identifying and copying all the required properties from one place to another. There are probably many more of them than can easily be identified, so writing a custom tool is likely to be error prone.

I want to do this on an Outlook client that has both POP3 and Exchange mail accounts attached to it.

SendOnBehalfOf seems only works between separate accounts on an Exchange server and the Microsoft reference suggests using CDO when applying it. CDO is deprecated, understandably (and attempts to use it have not worked for me, either). I have already discovered and solved the difficulties associated with using SendUsingAccount and discuss them here on stackoverflow.

Outlook.MailItem.SendUsingAccount is useful and solves half of this problem. It sets the mailbox from which the mail is sent. However, it seems that when a MailItem is created using VBA it always gets the characteristics of the default account (as in Account Settings). This behaviour is different from the interactive behaviour; then, the characteristics are those of the currently active mailbox (the one you have clicked on most recently.)

I have posted this separate question at the suggestion of vacip. Thanks, vacip!