Tech Dreams

Prevent Sending Emails Without Subject Line From Outlook

Outlook_LogoCreating a subject line is like creating a work of art. This line says how important it is to have subject when we send emails.Sending mails without the subject has always been a problem for most of us. Most of us forget to fill the subject line due to some reason or the other. Gmail and Rediffmail take care of this problem internally. But Yahoo and Outlook doesn’t have any mechanism to stop such mails that doesn’t have subject. I might not be able to provide you a solution to prevent this from happening in Yahoomail. But I have a solution to prevent it in Outlook.

Outlook allows us to write macros, which would stop us sending mails without a subject. All we have to do is to write a macro and save it. That takes care of preventing us for sending mails without a subject line.

To create a macro that pops up and asks if we really need to send a mail without a subject, follow the steps

  1. Open outlook
  2. Press Alt + F11 or click Tools –> Macro –> Visual Basic Editor to open the VB editor
  3. Press Ctrl + R or click view –> Project Explorer to open the project on the left side pane.
  4. Expand Project1 and you would find “Microsoft Office Outlook Objects”, Expanding this would show you “ThisOutlookSession”.
  5. Double click on “ThisOutlookSession” and paste the following lines.

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim strSubject As String
strSubject = Item.Subject
If Len(Trim(strSubject)) = 0 Then
Prompt$ = “Subject is Empty. Are you sure you want to send the Mail?”
If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, “Check for Subject”) = vbNo Then
Cancel = True
End If
End If
End Sub

Save the project and close it. Now try sending an email without subject line. A message box would pop up saying that there is no subject line and would you wish to continue sending the mail. Clicking “yes” would continue sending the mail and Clicking “No” would stop your mail. That’s it. Now you have an option to pen down your subject line even if you had forgotten it earlier. :-)