After completing a task in Outlook, many users may wish to send a notification email to notify someone, such as the superior. Sending the email manually will be time-consuming. This article will introduce a quick method to auto send this kind of emails.
From the article “4 Rapid Steps to Assign Task to Others in Your Outlook”, you can know that if the task is assigned to you from your superior and they’ve required a status report in advance, like the screenshot below, they will be able to receive a report email automatically.
However, if the task is just created on your own, Outlook will never send a notification email to anyone when you mark it as complete. In this case, if you would like to send a notification email to report your work, you have to do it manually. But with the following VBA codes, you can let Outlook automatically accomplish it.
Auto Send a Notification Email When a Specific Task Is Completed
- At first, you should start Outlook and shift to “Developer” tab.
- Then locate and click on the “Visual Basic” button. A new “Microsoft Visual Basic for Applications” window will show up.
- After that, double click “ThisOutlookSession” project to open it and then copy the following VBA codes into it.
Public WithEvents olItems As Outlook.Items Private Sub Application_Startup() Set olItems = Session.GetDefaultFolder(olFolderTasks).Items End Sub Private Sub olItems_ItemChange(ByVal Item As Object) Dim obApp As Outlook.Application Dim olMail As Outlook.MailItem Dim Recip As String 'Replace "test" as per your needs If InStr(LCase(Item.Subject), "test") > 0 And Item.Complete = True Then 'Replace with your desired contact Recip = "John Smith" If MsgBox("Do you want to send a report to " & Recip & " ?", vbYesNo + vbQuestion, "Confirm Sending Report") = vbYes Then Set obApp = Outlook.Application Set olMail = obApp.CreateItem(olMailItem) With olMail .To = Recip .Subject = "Complete: " & Item.Subject .Body = "Dear Mr. Smith" & vbCrLf & "I've completed this task in " & DateDiff("d", Item.CreationTime, Now) & " day" & Chr(40) & "s" & Chr(41) & "." & vbCrLf & vbCrLf & "Task Name: " & Item.Subject & vbCrLf & "Start Date: " & Item.StartDate & vbCrLf & "Due Date: " & Item.DueDate & vbCrLf & "Creation Time: " & Item.CreationTime & vbCrLf & "Completed Time: " & Now & vbCrLf & vbCrLf & "Task Details: " & vbCrLf & Item.Body .ReadReceiptRequested = True 'To directly send it,use ".Send" instead .Display End With End If End If End Sub
- Subsequently proceed to sign this code and change the macro settings to only permit digitally signed macros.
- Finally you can exit the current window and have a try.
- When you mark a task as complete, you will receive a message, like the following image:
- When you click on “Yes” button, a new message will open, shown as the picture below:
Note: If you replace “.display” with “.Send” line, this email will be sent out directly without showing up.
Pay Attention to Messages from Unknown Email Addresses
You must have ever received many emails from unknown addresses. It is advisable to keep careful of this kind of emails. It is because that they may look innocuous but contains malicious links, attachments or macros. Once you click or open them, your Outlook may get infected. At that point, in order to get back your Outlook data, you have no choice but to make use of a stellar damaged Outlook data fix utility, such as DataNumen Outlook Repair.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including repair SQL mdf problem and outlook repair software products. For more information visit www.datanumen.com