Deutsch
Content
 
 | 
SAM | 
| Determine the "identity" of your emails. Set with SAM the sender and the folder folder for sent items with the help of rules. | 
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.
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
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
 
 | 
Category-Manager | 
| With Category-Manager you can group your Outlook categories, share them with other users, filter a folder by category, automatically categorize new emails, and more. You can use the Addin even for IMAP. | 
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
 
 | 
SAM | 
| Determine the "identity" of your emails. Set with SAM the sender and the folder folder for sent items with the help of rules. |