从Outlook中的辅助电子邮件地址发送电子邮件的VBA代码 [英] VBA code to send email from Secondary email address in Outlook
问题描述
我在W7 x64上使用Excel 2010,并使用Ron de Bruin的代码从Outlook发送电子邮件。我有一个个人和组电子邮件地址,我发送,并正在寻找一种方式通过在VBA中更改组地址发送。
I am using Excel 2010 on W7 x64, and send email from Outlook using code from Ron de Bruin. I have an individual and group email address that I send from, and am looking for a way to send from the group address by changing it in VBA.
辅助地址是没有在Outlook中设置为实际帐户。如果我在Outlook中的文件 - 帐户设置,只列出一个电子邮件帐户。群组电子邮件地址只需转发到该组。
The secondary address is not set up as an actual account in Outlook. If I go to File - Account Settings in Outlook, there is only one email account listed. The group email address simply forwards to the group.
我为该组框创建了一个实际帐户,并在VBA中添加了对Microsoft Outlook对象库的引用,并添加了代码使用MailItem.SendUsingAccount属性在帐户1或2之间进行选择,但Outlook尝试从此地址发送时会冻结。
I created an actual account for the group box, and added the reference to Microsoft Outlook Object Library in VBA, and added the code to select between account 1 or 2 using the MailItem.SendUsingAccount property, but Outlook would freeze up when trying to send from this address.
当我发送电子邮件时,我可以在Outlook的从下拉框中选择我的个人和群组电子邮件。有没有另外一种方法可以在VBA中进行,而不必设置第二个帐户?
I can select between my Individual and Group email in the from dropdown box in Outlook when I send emails. Is there another way to do this in VBA without setting up a second account?
推荐答案
可以使用outlook的.SentOnBehalfOfName属性以其他用户的名义发送邮件。
请查看以下代码和网址以获取更多详细信息: http://www.slipstick.com/developer/code-samples/send-email-address-vba/
You can use .SentOnBehalfOfName property of outlook to send mail in the name of other user. Check the following code and URL for further details: http://www.slipstick.com/developer/code-samples/send-email-address-vba/
oMail.SentOnBehalfOfName = "user@domain.com"
这篇关于从Outlook中的辅助电子邮件地址发送电子邮件的VBA代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!