VBOffice

Send Delay

See how to defer the delivery of your emails. Instead of sending immediately, you could send your emails, for instance, in the evening at six o'clock.

Last modified: 2016/12/01 | Accessed: 30.373  | #163
◀ Previous sample Next sample ▶

Content

OLKeeper OLKeeper
OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or e-mails.

Send Every Email in the Evening

This sample sends every email on the evening of the same day at six o'clock.

It is necessary for this sample, as well as for the other following samples, that Outlook is still running when the email should be sent.


tip  How to add macros to Outlook
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
  Dim Mail As Outlook.MailItem
  If TypeOf Item Is Outlook.MailItem Then
    Set Mail = Item
    Mail.DeferredDeliveryTime = Date & " 06:00 PM"
  End If
End Sub

Send Emails With a Certain Subject The Next Monday

This sample sends every email with a certain subject the next Monday at 8 o'clock in the morning.

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
  Dim Mail As Outlook.MailItem
  If TypeOf Item Is Outlook.MailItem Then
    Set Mail = Item
    If Mail.Subject = "sample" Then
      Mail.DeferredDeliveryTime = GetNextWeekday(vbMonday) & " 08:00 AM"
    End If
  End If
End Sub

Private Function GetNextWeekday(ByVal DayOfWeek As VbDayOfWeek) As Date
  Dim diff As Long
  diff = DayOfWeek - Weekday(Date, vbSunday)
  If diff > 0 Then
    GetNextWeekday = DateAdd("d", diff, Date)
  Else
    GetNextWeekday = DateAdd("d", 7 + diff, Date)
  End If
End Function
ReplyAll ReplyAll
ReplyAll alerts you before unintentionally replying all, or if you are a confidential BCC recipient of the e-mail.

Send Emails With a Certain Category in the Morning of the Next Business Day

This sample sends every email with a certain category assigned in the morning of the next business day. So if you click on Send on a Friday, the email will be sent the next Monday.

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
  Dim Mail As Outlook.MailItem
  If TypeOf Item Is Outlook.MailItem Then
    Set Mail = Item
    If Mail.Categories = "sample" Then
      Mail.DeferredDeliveryTime = GetNextWorkday(1) & " 08:00 AM"
    End If
  End If
End Sub

Private Function GetNextWorkday(ByVal MinDaysOffset As Long) As Date
  Dim d As Date
  d = DateAdd("d", MinDaysOffset, Date)
  Select Case Weekday(d, vbMonday)
  Case 6: d = DateAdd("d", 2, d)
  Case 7: d = DateAdd("d", 1, d)
  End Select
  GetNextWorkday = d
End Function
Reporter Reporter
VBOffice Reporter is an easy to use tool for data analysis and reporting in Outlook. A single click, for instance, allows you to see the number of hours planned for meetings the next month.
email  Send a message