How to display alert in outlook express if subject field is empty while sending mail

In this article I am going to explain, how you can display alert from outlook if you click on "Send Mail" button without entering subject. This is a simple piece of VB code which will help you to display alert.

This is a common mistake every one does while sending mail using outlook. You feel bad if you send an important mail to the client or higher level manager without subject by mistake.

Since Microsoft didn't provide any option to make the subject mandatory or any warning for the empty subject it is our responsibility to find out the workaround.

This is a VB code which will display alert when you click on Send Mail button in Outlook if subject field is empty.

Just follow below steps,

1. Ofcourse we have to open the outlook

2. Then we will Open Visual basic editor by pressing ALT+F11

3. Then from left pane expand the Project1 untill you see "ThisOutlookSession"

4. Double Click on "ThisOutlookSession"

5. Now it's the time to copy and paste the below code in the new window opened when you double click on "ThisOutlookSession".

6. Save and Close the window. You are done!


Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim strOutlookSubject As String
strOutlookSubject = Item.Subject
If Len(strOutlookSubject) = 0 Then
Prompt$ = "Are you sure you want to send the Mail without Subject?"
If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Subject is empty") = vbNo Then
Cancel = True
End If
End If
End Sub

Note: Change the alert as per your interest from above code.

Now try to send mail without subject from your outlook you will see that wonderfull alert!!!

12 Comments

Comments have been disabled for this content.