Outlook Missing Warning on Empty Subject

A couple of times I've sent emails with blank subject line unknowningly.

Blank subject emails are often blocked or filtered.

For Outlook 2007, and perhaps 2003, there doesn't seem to be a warning pop-up upon sending an email with an empty subject line.

Solution: (Thanks to Ankit Jain)

Need to write macro in Visual Basic editor (Alt-F11) -> Microsoft Office Outlook->ThisOutlookSession (double click) and paste code below to right panel.

For MS Outlook 2007 (Works)

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim Answer As String


If IsNull(Item.Subject) Or Len(Item.Subject) = 0 Then


Answer = MsgBox("Subject field is empty. Do you still want to
send the e-mail? ", vbYesNo + vbQuestion, "Missing subject")


If Answer = vbYes Then
Cancel = False


ElseIf Answer = vbNo Then
Cancel = True


End If


End If
End Sub

 

 

For MS Outlook 2003 (I have not tested)

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim strSubject As String
strSubject = Item.Subject
If Len(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

This entry was posted in Technical. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.