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. :-)

30 Comments on Prevent Sending Emails Without Subject Line From Outlook

  1. Yojana
    November 17, 2011 at 6:53 pm (8 years ago)

    Thank u so much !!! It worked for me !! :)

    Reply
  2. GS
    June 16, 2011 at 11:21 am (8 years ago)

    The steps work fine.. but only for the current session.. if you restart outlook or the system.. it wont work. We need to change the security setting in outlook to make sure that the macro is enabled during any session..
    1. In the Tools menu, click Trust Center.
    2. Click on Macro Security.
    3. Now Click the options that you want:
    i. No warnings and disable all macros Click this option if you don’t trust macros. All macros and security alerts about macros are disabled.
    ii. Warnings for signed macros; all unsigned macros are disabled This is the default setting and is the same as the Disable all macros with notification option, except that if the macro is digitally signed by a trusted publisher.
    iii. Warnings for all macros Click this option if you want macros to be disabled, but you want to get security alerts if there are macros present. This way, you can choose when to enable those macros on a case by case basis. (My Recommendation)
    iv. No security check for macros (Not recommended) Click this option to allow all macros to run. This setting makes your computer vulnerable to potentially malicious code and is not recommended.

    If you select option (iii), then after restarting Outlook there will be a pop-up that will ask whether to enable or disable the Macro…. (Always Select “Enable Macro”, to get the proper functionality)
    If selected option is (iv), the functionality will still be proper, but its recommended that you don’t play with security levels.

    Reply
  3. Target
    June 2, 2011 at 12:52 pm (8 years ago)

    Working for me after I replaced the quotes.
    Thanks a lot. I just sent a mail to my boss with no subject and i think he didn’t liked it.
    So, you saved me.

    Reply
  4. Ashesh
    February 23, 2011 at 11:03 am (9 years ago)

    Working for me, alert worked.

    Reply
  5. Medowl
    February 9, 2011 at 2:47 pm (9 years ago)

    @Rockfox : http://www.howto-outlook.com/howto/selfcert.htm

    Add your own certificate (see link), set macro security back to default & restart outlook. You’ll get a warning, but you can now choose to allways trust this certificate. from there it should work with default security settings and no more warnings..

    Reply
  6. RockFox
    January 27, 2011 at 10:41 pm (9 years ago)

    In Outlook 2007 the macro worked the first time I sent an email without a subject. When I closed Outlook and restarted, the macro did not seem to run on Send. I then changed the macro security to “Warnings on all macros”. This di not work either until I recycled Outlook and the I get the message that ThisOutlookSession macros have been disabled. I enabled them and the macro worked correctly.

    Major kudos to someone who can tell me how to enable THIS macro to always run (without enabling all macros).

    Reply
  7. Diana
    January 26, 2011 at 8:44 pm (9 years ago)

    Thank you…Once I swapped out all of the special quotes in the code with regular ones, the Alert worked perfectly!

    Reply
  8. satya
    January 14, 2011 at 4:51 pm (9 years ago)

    Thanx it relly good…

    Reply
  9. grimix
    January 5, 2011 at 11:53 am (9 years ago)

    Thanks – I needed this! The lines with quotes were shown in red (compile error). I had to replace the quotes to work properly. Seemed to be wrong font so VB did not recognise it as a quote.

    Reply
  10. Scorpz
    December 16, 2010 at 1:27 am (9 years ago)

    Thanks, this code works great with Outlook 2007! My only misgivings is allowing all Macros, in order for the code to run correctly.

    Reply
  11. Klemen
    December 14, 2010 at 3:50 pm (9 years ago)

    Working great!

    I just had to copy the code to word and change the Font.

    It was something with the quotes (“xy”)

    Thank you

    Reply
  12. Eric
    December 11, 2010 at 12:46 am (9 years ago)

    I need certain words to always appear in my Outlook subject line (Like my company name with the option to add to it)- is this possible? can anyone help me set this up????

    Reply
  13. Irfan
    November 1, 2010 at 10:51 am (9 years ago)

    Thats great

    Reply
  14. Mallakkara
    October 20, 2010 at 7:18 pm (9 years ago)

    Not working for me (‘m using 2007)
    “MsgBox “Please fill in the subject before sending”, vbExclamation, “Missing Subject””
    THis is filed is coming as red

    Reply
  15. Sanjay Patel
    October 12, 2010 at 8:59 pm (9 years ago)

    Its great :) Thank you Suganya !

    Reply
  16. Saminathan
    October 1, 2010 at 3:22 pm (9 years ago)

    How to avoid sending mails without Content from Microsoft Outlook2007 ?

    Reply
  17. Vismaya
    August 18, 2010 at 6:00 pm (9 years ago)

    Thank you so much Suganya.
    It’s working fine. :)

    Reply
  18. Aditya
    August 18, 2010 at 4:02 pm (9 years ago)

    Hi,
    The macro is running fine.
    Thanx!!
    But when i lock my system and unlock it again…
    The VB editor window gets opened each time and has to be closed (which is very irritating :P )
    Please suggest some work around…

    Reply
  19. Niraj
    August 4, 2010 at 4:22 pm (9 years ago)

    try this:

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

    Dim strMsg As String

    Dim res As Long
    If Item.Subject = “” Then

    Cancel = True

    MsgBox “Please fill in the subject before sending”, vbExclamation, “Missing Subject”

    End If

    End Sub

    Reply
  20. kumar
    June 16, 2010 at 6:05 pm (9 years ago)

    this is not working …..

    Reply
  21. rajesh
    April 17, 2010 at 4:14 pm (9 years ago)

    not working

    Reply
  22. John
    March 25, 2010 at 2:38 am (9 years ago)

    To enable this macro on startup, In Outlook 2007, select Tools -> Macro -> Security -> “Warnings for all macros” (or accept all macros).

    To use this setting, need to exit Outlook, and restart Outlook. On restart, you get warning about macros “ThisOutlookSession”. You need to enable macros on this startup warning.

    Reply
  23. Ramesh
    February 4, 2010 at 9:31 am (10 years ago)

    I need to add the word (Secure) in the subjectline of all emails that I send, reply or forward. How do I do this? Can somebdy help me pls.

    Reply
  24. Bob
    January 4, 2010 at 11:43 pm (10 years ago)

    The Compile Error is due to the fancy quotes in the copy/paste operation from this web page. Just delete and replace the double quotes in lines 5 and 6.

    Reply
  25. Dave
    December 7, 2009 at 10:26 pm (10 years ago)

    MS Office 2007. Followed the directions as above.

    When sending an e-mail w/o a subject, I get a message that says” Compile Error: Syntax Error. If I click OK, the line “Private Sub Application_ItemSend (ByVal Item As Object, Cancel As Boolean) is highlighted yellow.

    The lines starting Prompt$ and If MsgBox are red.

    Reply
  26. Dr DC
    November 6, 2009 at 2:56 am (10 years ago)

    Does this work in Outlook 2007? I am leary to try it on my work computer, but really need it.

    Reply
  27. ajay
    September 16, 2009 at 6:58 pm (10 years ago)

    go to TOOLS->MACRO->SECURITY and select warnings for all MACROS or no security for macros(this enables macros every time you restart outlook)

    Reply
  28. Todd
    August 7, 2009 at 8:16 pm (10 years ago)

    Thanks! This is a great way to make Outlook behave more like Thunderbird.

    One problem I’ve noticed though, is that the macro is connected to “ThisOutlookSession” and seems to not run properly once Outlook is closed and reopened.

    I’ll do some experimenting and post if I find a solution, but if anyone knows how to make this persistent, please clue us in.

    Reply
  29. Irfan
    July 31, 2009 at 11:52 pm (10 years ago)

    Same with me also, my mails are going without subject line.I am not getting the pop up.
    Can anyone kindly look into the issue.

    Reply
  30. rohan
    April 25, 2009 at 5:29 pm (10 years ago)

    its not working my mails are still going without subject

    Reply

Leave a reply