在 VBA 中发送延迟时间的 Outlook 电子邮件不会在第二天发送?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3941023/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Sending outlook email in VBA with a defered time wont send the next day?
提问by Anthony
What I'm attempting to do is send an email using VBA in excel though outlook but with a defered send date/time for the next day about 8:30. The code bellow, will send an email fine, it will even send one with a derfered send time even when my workstation is locked, however it seems when i set it to next day 8:30 they just stay in my outbox untill I open them up and hit, I can even open them up and hit send before the defered time and they will send fine, or after and they will send imediatly.
我正在尝试做的是通过 Outlook 使用 Excel 中的 VBA 发送电子邮件,但将发送日期/时间推迟到第二天大约 8:30。下面的代码会很好地发送一封电子邮件,即使我的工作站被锁定,它甚至会发送一个延迟发送时间的电子邮件,但是当我将其设置为第二天 8:30 时,它们似乎只是留在我的发件箱中,直到我打开它们向上并点击,我什至可以打开它们并在延迟时间之前点击发送,他们会很好地发送,或者之后,他们会立即发送。
The deferedtime variable passed in is a string formated "dd/mm/yyyy hh:mm:ss" e.g "15/10/2010 08:30:00"
传入的延迟时间变量是一个格式为“dd/mm/yyyy hh:mm:ss”的字符串,例如“15/10/2010 08:30:00”
Sub Send_Outlook_Email(Addresses, attach, strSubject, strBody, defertime)
Dim objOL As Outlook.Application
Dim msg As Outlook.MailItem
Set objOL = New Outlook.Application
Set msg = objOL.CreateItem(olMailItem)
Dim d As Date
strEmail = ""
For i = 0 To UBound(Addresses)
strEmail = strEmail & Addresses(i) & "; "
Next
strEmail = Trim(strEmail)
With msg
.To = strEmail
.subject = strSubject
.HTMLBody = strBody
For i = 0 To UBound(attach)
strAttach = attach(i)
If Len(strAttach) > 0 And Len(Dir(strAttach)) > 0 Then
.Attachments.Add (strAttach)
End If
Next
.DeferredDeliveryTime = defertime
.Send
End With
End Sub
Am I missing something important?
我错过了什么重要的东西吗?
回答by Fil
cached mode
- disable it.
cached mode
- 禁用它。
This happened to me and an IT guy at my job was able to help me fix it. I am running Office 2010
.
这发生在我身上,我工作的一名 IT 人员能够帮助我修复它。我在跑步Office 2010
。
回答by GvS
The DeferredDeliveryTime
is a property of an Outlook mail message.
该DeferredDeliveryTime
是一个Outlook邮件的属性。
If you have an Exchange server, the "delayed sending" will be done by Exchange. If you do not have Exchange your Outlook application needs to be active.
如果您有 Exchange 服务器,则“延迟发送”将由 Exchange 完成。如果您没有 Exchange,则您的 Outlook 应用程序需要处于活动状态。