从 Outlook 中的另一个电子邮件地址发送 [英] Send from another email address in Outlook
问题描述
我的用户将他们的个人邮箱作为他们的主要帐户,并在他们的 Outlook 2010 客户端中配置了一个自动映射的共享邮箱.共享邮箱是 Office 365 共享邮箱,因此无法登录以将其设置为主帐户.
My users have their personal mailbox as their primary account and an auto-mapped shared mailbox configured in their Outlook 2010 client. The shared mailbox is an Office 365 shared mailbox and thus cannot be logged into to set it as the primary account.
我正在尝试从共享帐户的地址开始一封新电子邮件.
I am trying to start a new email from the shared account's address.
下面是我一直在尝试使用的 VBA 代码.我已在 Outlook 的信任中心设置中允许使用宏.
Below is the VBA code I have been trying to use. I have allowed Macros in Outlook's trust center settings.
Public Sub New_Mail()
Dim oAccount As Outlook.Account
Dim oMail As Outlook.MailItem
For Each oAccount In Application.Session.Accounts
If oAccount = "sharedMailboxAddress@domain.tld" Then
Set oMail = Application.CreateItem(olMailItem)
oMail.SendUsingAccount = oAccount
oMail.Display
End If
Next
End Sub
推荐答案
将以下代码与 SentOnBehalfOfName 属性一起使用可从共享邮箱的地址开始一封新电子邮件.感谢 Dmitry Streblechenko 为我指明了正确的方向.
Using the following code with the SentOnBehalfOfName property starts a new email from the shared mailbox's address. Thanks to Dmitry Streblechenko for pointing me in the right direction.
Sub New_Mail()
Dim objMsg As MailItem
Set objMsg = Application.CreateItem(olMailItem)
With objMsg
.SentOnBehalfOfName = "sharedMailboxAddress@domain.tld"
.Display
End With
Set objMsg = Nothing
End Sub
这篇关于从 Outlook 中的另一个电子邮件地址发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!