如何代表代表在 Outlook 中发送电子邮件? [英] How to send email in Outlook on behalf of a Delegate?
问题描述
我正在编写一个 VBA 脚本,它将向我们的客户发送电子邮件.我以前做过类似的系统,但这里的区别在于这些电子邮件将使用通用的发件人字段(因此收件人只能看到我们公司的名称,而不是发送它的个人).这很容易手动完成.
I'm writing a VBA script that will fire off emails to our customers. I've made similar systems before, but the difference here is that these emails will use a generic From field (so the recipient only sees our company's name and not the individual sending it). This is easy to do manually.
目前,我正在使用具有通用示例.但我无法弄清楚如何使用该代码,因为它本身并不是这台机器上的实际帐户.我只有授权访问权限.
Currently, I'm playing around with the SendUsingAccount with generic examples. But I can't figure out how to use that code since it's not an actual account on this machine per se. I just have delegate access to it.
那么,有人可以告诉我如何使用 VBA 代表其他人发送电子邮件吗?
So, can someone show me how to send email on behalf of someone else using VBA?
(或者,我确实有该帐户的用户名和密码.因此,如果我需要登录该帐户来发送电子邮件,我也可以这样做)
(Alternatively, I do have the username and password to the account. So, if I need to log into that account to send the email, I can do that too)
推荐答案
查看 MailItem.SentOnBehalfOfName 属性.您应该拥有对要代表其发送的邮箱/个人资料的委托访问权限.
Check out the MailItem.SentOnBehalfOfName Property. You should have delegate access to the mailbox/profile on whose behalf you want to send.
Sub SendEmailOnBehalf()
Dim msg As Outlook.MailItem
Set msg = Outlook.CreateItem(olMailItem)
With msg
.SentOnBehalfOfName = "Jimmy's boss' name"
.Subject = "Email from someone else"
.Body = "Hello" & vbNewLine
End With
End Sub
电子邮件会在 From:
字段中显示 From Jimmy Pena for Jimmy's Boss
.
The email would say From Jimmy Pena on behalf of Jimmy's Boss
in the From:
field.
这篇关于如何代表代表在 Outlook 中发送电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!