Send mail with specific mailbox defaults from Outlook with POP3 or Exchange

走远了吗. 提交于 2019-12-12 03:44:17

问题


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!

来源:https://stackoverflow.com/questions/37785761/send-mail-with-specific-mailbox-defaults-from-outlook-with-pop3-or-exchange

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!