How can I automatically send an email with delay from an Outlook inbox usign VBA?

烂漫一生 提交于 2019-12-02 07:54:16

Try using DeferredDeliveryTime Property Which sets the time mail is to be delivered.

Example

Option Explicit
Public Sub Example()
    Dim Item As Outlook.MailItem

    Set Item = Application.CreateItem(0)

    With Item
        .Subject = "test"
        .To = "0m3r"
        .DeferredDeliveryTime = DateAdd("n", 10, Now)
         Debug.Print Item.DeferredDeliveryTime
        .Send
    End With

    Set Item = Nothing
End Sub

DateAdd Function

DateAdd("n", 10, Now)

+--------+-----------------+
| Value  |   Explanation   |
+--------+-----------------+
| yyyy   | Year            |
| q      | Quarter         |
| m      | Month           |
| y      | Day of the year |
| d      | Day             |
| w      | Weekday         |
| ww     | Week            |
| h      | Hour            |
| n      | Minute          |
| s      | Second          |
+--------+-----------------+
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!