可以通过VBA正常发送电子邮件,但是当我使用.SentOnBehalfOfName属性时,电子邮件将保留在发件箱中

时间:2019-01-25 07:58:10

标签: excel vba outlook

在我看来,我有不同的邮箱,我自己的邮箱和我的部门之一。我想从我的部门地址发送电子邮件,而我正在使用属性.SentOnBehalfOfName进行发送。我是用excel来做的,我有Office 2010。

尽管收件人正在从我的部门地址接收电子邮件,但这些电子邮件仍被卡在我的个人发件箱中(例如等待发送...)。当我发送的电子邮件数量大于30(因为达到内存空间限制)时,这将成为一个问题。

有人知道如何避免这些电子邮件卡在我的个人发件箱中吗?

这是我用来发送电子邮件的代码:

Sub MandaMail(destinatarios As String, copia As String, subject As String, strbody As String, Optional CO As String = "")

Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim SigString As String
Dim Signature As String

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next

With OutMail
    .To = destinatarios
    .CC = copia
    .BCC = CO
    .subject = subject
    .HTMLBody = strbody 
    .SentOnBehalfOfName = "mydeparmentemail@mycompany.es"
    .send    
End With

On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing

预先感谢

0 个答案:

没有答案