在每封发送的电子邮件上设置.SentOnBehalfofName [英] Set .SentOnBehalfofName on every email sent

查看:585
本文介绍了在每封发送的电子邮件上设置.SentOnBehalfofName的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在通过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 = "example@aol.com"
    .Display
End With

End Sub


Private Sub myItem_Open(Cancel As Boolean)

    FromField

End Sub

推荐答案

有关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.

如果在配置文件中配置了多个帐户,则可以使用

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 ("someone@example.com") 
    oMail.Recipients.ResolveAll 
    oMail.SendUsingAccount = oAccount 
    oMail.Send 
   End If 
  Next 
 End Sub 

这篇关于在每封发送的电子邮件上设置.SentOnBehalfofName的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆