If you need to prevent yourself from sending specific emails outside working hours, you can utilize the method shown in this article. It can let Outlook auto check if it’s in working hours when you send specific emails and delay it until working hours.
At times, the time when you compose and send a mail isn’t within your working hours. In this case, you may wish to delay sending this email until the subsequent working hours. Generally, you can use the native feature “Delay Delivery” to delay such emails. However, by that means, you ought to specify the delivery time every time. It is too troublesome. Thereinafter, we will share you a piece of VBA code, which can auto check if it is within working hours when you send a specific email and rapidly delay sending it until the working hours.
Quickly Delay Sending Specific Emails until Working Hours
- At the very outset, launch your Outlook program.
- Then in the emerging Outlook main screen, you could press “Alt + F11” keys.
- Next you will get access to Outlook VBA editor in success.
- After that, you need to locate and open the “ThisOutlookSession” project.
- Subsequently, copy the following VBA code into this project window.
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) Dim objMail As MailItem Dim NewSendTime As String Dim bDelayMail As Boolean Dim nPrompt As Integer bDelayMail = True If TypeOf Item Is MailItem Then Set objMail = Item 'Work on specific emails only 'You can change the conditions as per your needs If objMail.Recipients.Item(1).Address = "email@example.com" Then Select Case Weekday(Date, vbMonday) 'Delay 2 days if today is Saturday Case 6 NewSendTime = (Date + 2) & " 09:00:00" 'Delay 1 days if today is Saturday Case 7 NewSendTime = (Date + 1) & " 09:00:00" Case Else If DatePart("h", Now) < 9 Then 'Delay to 9 o'clock if now is too early NewSendTime = Date & " 09:00:00" ElseIf DatePart("h", Now) > 18 Then Select Case Weekday(Date, vbMonday) 'Delay 3 days if today is Friday and now is over 6 PM Case 5 NewSendTime = (Date + 3) & " 09:00:00" 'Delay to 9 o'clock if now is before 6 PM Case Else NewSendTime = (Date + 1) & " 09:00:00" End Select Else bDelayMail = False End If End Select If bDelayMail = True And objMail.DeferredDeliveryTime = "1/1/4501" Then 'Ask if to delay sending this email nPrompt = MsgBox("Outside Working Hours:" & vbCrLf & "Do you want to delay this email until " & NewSendTime & "?", vbYesNo + vbExclamation, "Delay Email") If nPrompt = vbYes Then objMail.DeferredDeliveryTime = NewSendTime Else objMail.DeferredDeliveryTime = "1/1/4501" End If End If End If End If End Sub
- Later you will be required to assign a digital certificate to this email.
- And then change your Outlook macro settings to permit the signed macros.
- From now on, every time you send emails which meet the predefined criteria, if it is outside working hours, you will get a prompt like the following image:
- If you select “Yes”, Outlook will schedule it to be sent out until working hours.
Rescue Damaged Outlook Files
Outlook has earned a lot of kudos due to its myriad features. However, it still has a deadly flaw. That is Outlook is prone to errors and corruption. Hence, you ought to back up your Outlook files on a regular basis. It can prevent you from suffering painful Outlook data loss. In addition, you had better get hold of a mighty repair tool, such as DataNumen Outlook Repair, which can repair Outlook issues within seconds.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including mdf recovery and outlook repair software products. For more information visit www.datanumen.com