Surprisingly, some users hate this but there is no way to disable it in Outlook Options. If want to disable this warning, you can disable the warning using a macro.
Anyone using Outlook 2007 or older who wants a warning when the subject line is blank needs to use a macro.
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
How to use this macro
Using a macro in Outlook, short version:
- Step 1: Enable macros in Tools, Macro Security or Tools, Trust Center (Outlook 2007). We recommend the 'warn for all macros' setting (Medium in Outlook 2003 and older). With this enabled, you'll need to allow macros each time you start Outlook. In older versions of Outlook, you may need to close and restart Outlook before the macros will work.
- Step 2: Open the VBA Editor using Alt+F11 keystroke.
- Step 3: Expand the Project menu and select ThisOutlookSession
- Step 4: Copy and paste the macro into ThisOutlookSession. The text should be blue, green and black. Red text means there is a syntax error in that line.
- Step 5: Save (Ctrl+S or Save button). Note: you'll need to save the VBA project when you close Outlook too.
Test the macro by sending a message with a blank subject.
If it works as expected, you can use SelfCert to sign the macro then set Outlook's macro security to signed macros only. Instructions for using SelfCert are available at How to use Outlook’s VBA Editor
Warn before doing other stuff...
You can use this to warn about things beside a blank subject. Depending on what you are checking, you will need to either remove or edit the first two lines:
Dim strSubject As String
strSubject = Item.Subject
Then change the IF statement to test the field you want to test:
If Len(Trim(strSubject)) = 0 Then
For example, to check the TO address, we need to change those lines to this:
'Item = MailItem
If Item.To = "alias@domain.com" Then
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) 'Item = MailItem If Item.To = "alias@domain.com" Then Prompt$ = "Are you sure you want to send this message?" If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Check before Sending") = vbNo Then Cancel = True End If End If End Sub
More code samples are available at
More Information
More Code Samples:
E-Mail: Check item size before sending
I see this code all over the internet and everyone says how wonderful
it works but it doesn't work for me, I'm clueless, any ideas why? I'm not
getting an error, it just seems to not run the macro. Windows 7 Office 2010.
it definitely won't show in the macro list (first screen shot) - it's an auto macro and will run when you send a message. You don't need to do anything to make it run (but click Send).
Do you have macro security set to low? That is the usualy cause...
(I'll try to record a video showing how to do it and it in action tomorrow. )
Thank you for responding and for your help, I really appreciate it.
Yes, security is as low as possible. I’ve tried running this on
Windows-7 Office 2010 and Windows-10 Office 2016 and also tried
changing the fourth line… it’s driving me a little nutty.
From… If Len(Trim(strSubject)) = 0 Then
To… If Len(Trim(strSubject)) = "No" Then
Now wait a minute - why do you need this with either outlook 2010 or 2016? It has the warning built in - you should get this dialog box. If you also use the macro, it will come up after this one.
oh, i see the problem - len is length.
Use this instead
If InStr(1, strSubject, "Phrase") > 0 Then
If there is any chance any letter in the string could be a different case, use lowercase for everything:
If InStr(1, lcase(strSubject), "phrase") > 0 Then
I created a request form with fields for users to enter in Outlook. However, I would like all the fields to be entered prior to the form getting sent. How can I prompt a message box stating "Please enter all the fields" when the user is trying to send the form with one or more blank fields?
1.Is there is way to add any prompt on recieving any mail in Outlook.For exaple.
Do you want to archieve this mail.
2.On Yes, I want to use our own Product calls to archieve emails in repository.
3. Once Archieved , Flag of mail should be marked stating that mail has been archieved in repository.?
Do you want the prompt as the mail arrives? if so, an itemadd macro can do the prompt and the flag. Whether it can use your archiving software depends on the software.
I use a template in outlook 2007 where I need to edit the subject every time before I send it. In the template, the subject is "Ticket #". What is the code to get a prompt before sending out a message with a specific subject? I want it to warn me if I forget to edit the subject of the template. So If the subject = "Ticket #" then prompt me if I want to send out the email.
use this - first 8 characters = ticket # to prompt for all messages that begin with ticket #. if you wanted to warn only if there was not something after ticket #, use the second one, 10 would allow for 2 digit or larger ticket #. That can be increased.
If Left(strSubject, 8) = "Ticket #" Then
If Left(strSubject, 8) = "Ticket #" and Len(Trim(strSubject)) < 10 Then
I would like to applaud you for following up on comments from an almost three yr old post!
I am trying to modify a subject to apply some leading text (to encrypt via our servers) to emails sent to any address besides two specific ones. I modified the code based off something I found online a while ago to just add the encrypt text to everything, but it gets kind of messy with some people's filters. Below is the code, any thoughts how to fix it? Thank you in advance!
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
If (Right(Trim(Item.To), 15)) "@exampleone.com" Then
Item.Subject = Item.Subject
ElseIf (Right(Trim(Item.To), 15)) "@exampletwo" Then
Item.Subject = Item.Subject
Else
If (Left(Trim(Item.Subject), 8)) "SECURE: " Then
Item.Subject = "SECURE: " + Item.Subject
End If
End If
End Sub
The macro at https://www.slipstick.com/developer/code-samples/add-secure-message-subject-sending/ uses a cleaner method if you need to exclude multiple domains and also check all of the recipient addresses.
Not sure the purpose of this - if the subject has secure, it doesn't need it added. Oh, i bet wordpress ate the 'does not equal brackets' <>
If (Left(Trim(Item.Subject), 8)) "SECURE: " Then
Item.Subject = "SECURE: " + Item.Subject
These could be combined into an OR... but the else works too. just exit sub and send if the statement is true.
If (Right(Trim(Item.To), 15)) "@exampleone.com" Then
exit sub
ElseIf (Right(Trim(Item.To), 15)) "@exampletwo" Then
exit sub
Else
If (Left(Trim(Item.Subject), 8)) <> "SECURE: " Then
Item.Subject = "SECURE: " + Item.Subject
That was prefect. Thank you!
Is there a way to add if the address is an Exchange address, as those do not show domains? Thank you!
So you want it to trigger for any internal email address? Try looking for /ou in the address or "" (nothing). if that fails, you couls look up the pr_smpt_address - 'Check for different domains' macro at https://www.slipstick.com/how-to-outlook/prevent-sending-messages-to-wrong-email-address/ shows how.
can you help me with the code for warning message "Please read the email or check the attachment before sending"
if you want to check all mail, remove the If and End if lines. Change the text within the prompt string.
Diane,
If I just want a macro to stop any and every email before I send it so I can check it one more time, what would I do? I'm not checking for a specific field. Rather, I simply want a "speed bump" with text in the pop up that makes me reconsider sending it or allows me to cancel if I'm not sure.
I've done this before, looking at your site (I think) but I've forgotten now that I switched to a new computer.
If you remove the IF and end if lines, it'll check all messages.
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Prompt$ = "Are you sure you want to send this message?"
If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Check before Sending") = vbNo Then
Cancel = True
End If
End Sub
Hi Everyone,
I want to create a Macro in outlook 2013. If I am attaching anything in email then a popup box should appear with the statement “You are attaching a file. Please check if XYZ field available in the file” Presse YES or NO. Also in the popup box should be one check box If I checked the button then a note should be include with the email.
Please help me to solved this out.
That one is complicated and I don't have any macro samples that do that. Sorry.