问题描述
我试图在通过Outlook 2016发送的每封电子邮件上设置.SentOnBehalfOfName.也就是说,每当我单击新建邮件",答复",全部答复"或转发".
I am trying to set the .SentOnBehalfOfName on every email I send through Outlook 2016. That is, whenever I hit New Mail, Reply, Reply All, or Forward.
我尝试过:
Public WithEvents myItem As Outlook.MailItem
Private Sub Application_ItemLoad(ByVal Item As Object)
If (TypeOf Item Is MailItem) Then
Set myItem = Item
End If
End Sub
Private Sub FromField()
With myItem
.SentOnBehalfOfName = "[email protected]"
.Display
End With
End Sub
Private Sub myItem_Open(Cancel As Boolean)
FromField
End Sub
推荐答案
SentOnBehalfOfName 属性仅在使用Exchange配置文件/帐户的情况下才有意义.此外,您需要具有所需的权限才能代表他人发送.参见有关SentOnBehalfOfName的问题,以进行类似的讨论.
The SentOnBehalfOfName property makes sense only in case of Exchange profiles/accounts. Moreover, you need to have the required permissions to send on behalf of another person. See Issue with SentOnBehalfOfName for a similar discussion.
如果在配置文件中配置了多个帐户,则可以使用 SendUsingAccount 属性,该属性允许一个Account对象,该对象代表要在其下发送MailItem的帐户.
In case if you have multiple accounts configured in the profile you can use the SendUsingAccount property which allows to an Account object that represents the account under which the MailItem is to be sent.
Sub SendUsingAccount()
Dim oAccount As Outlook.account
For Each oAccount In Application.Session.Accounts
If oAccount.AccountType = olPop3 Then
Dim oMail As Outlook.MailItem
Set oMail = Application.CreateItem(olMailItem)
oMail.Subject = "Sent using POP3 Account"
oMail.Recipients.Add ("[email protected]")
oMail.Recipients.ResolveAll
oMail.SendUsingAccount = oAccount
oMail.Send
End If
Next
End Sub
这篇关于在每封发送的电子邮件上设置.SentOnBehalfofName的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!