从Hotmail帐户发送时Outlook vba问题

问题描述 投票:0回答:1

我有一个Outlook VBA程序,该程序将电子邮件发送到电子表格中包含的500多个收件人的列表中。该程序可以运行,但是当我从Hotmail帐户发送电子邮件时,我发现有些奇怪。在宏结束之前,不会发送电子邮件。好像它们被挂在某个地方,直到宏结束。另一方面,当我从GMail帐户发送邮件时,每当遇到“ .send”代码时都会发送一封电子邮件。我调用了一个延迟例程(KillSomeTime),以便发送服务器不会被淹没,并减少了将电子邮件视为垃圾邮件的可能性。但是,当“ .SendUsingAccount”是hotmail帐户时,该延迟例程是没有意义的,因为它们都立即处理。这是发送电子邮件的代码的子集:

With objNewItem
    .Display
    'Store the selected sender into objNewItem.SendUsingAccount
    .SendUsingAccount = objSelectedAccount
    'Store the original body into the new item body.
    'NOTE:  HTMLBody preserves the rich text.
    .HTMLBody = objOriginalItem.HTMLBody
    .Subject = objOriginalItem.Subject
    .To = strEmailAddress
        'Loop through the attachments in objOriginalItem
        'Save them to the user's temp folder.
        'Attach them to objNewItem.
        For Each objAtt In objOriginalItem.Attachments
            strAttFile = strTempPath & objAtt
            objAtt.SaveAsFile strAttFile
            objNewItem.Attachments.Add strAttFile, , , objAtt.DisplayName
            objFSO.DeleteFile strAttFile
        Next
    .Send
    'Set and Start objSyncObject to execute "Send / Receive" for this item
    Set objSyncObject = objSyncObjects(1)
    objSyncObject.Start
    'Call the log_event function
    Call log_event(strSubject, strEmailAddress)
    'Call the kill_some_time function
    Call kill_some_time(lngPauseTime)
End With

是否有任何方法可以对代码进行调整,以便将Hotmail延迟执行“ .Send”的原因考虑在内?

vba outlook hotmail
1个回答
0
投票

您可以尝试使用MailItem.DeferredDeliveryTime属性,该属性允许设置一个日期,该日期指示要发送邮件的日期和时间。

© www.soinside.com 2019 - 2024. All rights reserved.