How to Get Warned when Trying to Input Special Characters in Outlook Email Subject

As the emails whose subjects contain special characters can be recognized as spams, you’d better not input special characters in email subject. This post will teach you to let Outlook auto warn you when typing special characters in email subject.

As we all know, if an email’s subject contains special characters, such as “$”, “#”, “&” and so on, it can be recognized as junk email. Also, when saving an email to local drive, the special characters are not supported in naming it. So, it is always suggested not to use special characters in email subject. Here we will guide you how to configure your Outlook to auto warn you when trying to input special characters in email subject.

Get Warned when Trying to Input Special Characters in Outlook Email Subject

Get Warned when Trying to Input Special Characters in Email Subject

  1. In the first place, start your Outlook program.
  2. Then, in the main Outlook window, press “Alt + F11” key buttons.
  3. Next, in the following VBA editor, you ought to enable“Microsoft VBScript Regular Expressions”. Click ‘Tools” > “References” to accomplish it.
  4. After that, you can locate and open the “ThisOutlookSession” project.
  5. Subsequently, you could copy the VBA code below into this project.
Public WithEvents objInspectors As Outlook.Inspectors
Public WithEvents objMail As Outlook.MailItem

Private Sub Application_Startup()
    Set objInspectors = Outlook.Application.Inspectors
End Sub

Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector)
    If TypeOf Inspector.CurrentItem Is MailItem Then
       Set objMail = Inspector.CurrentItem
    End If
End Sub

Private Sub objMail_PropertyChange(ByVal Name As String)
    Dim objRegExp As RegExp
    Dim strSubject As String
    Dim bIsValidSubject As Boolean
 
    If Name = "Subject" Then
       strSubject = objMail.Subject
 
       Set objRegExp = New RegExp
 
       With objRegExp
            .MultiLine = False
            .Global = True
            .IgnoreCase = True
            .Pattern = "[^a-zA-Z0-9]"
       End With
 
       bIsValidSubject = Not objRegExp.Test(strSubject)
 
       'If the subject contains special characters
       If bIsValidSubject = False Then
          'Get warned
          MsgBox "Don't input special characters in email subject!", vbExclamation + vbOKOnly, "Check Subject"
       End If
    End If
End Sub

VBA Code - Get Warned when Trying to Input Special Characters in Email Subject

  1. Later you should sign this code. Go to “Tools” > “Digital Signature” to achieve it.
  2. Afterwards, close the current window by clicking the “X” button in the upper right corner.
  3. Then, head to “Outlook Options” > “Trust Center” to enable signed macros.
  4. Finally you could restart your Outlook to activate this new VBA project.
  5. From now on, every time when you compose an email and input any special characters into the email subject, you’ll get a warning, shown as the following screenshot:Warning

Prevent Outlook Damage

Since Outlook is vulnerable, it is quite hard to prevent it from corruption. But, if you have taken adequate and effective precautions, you can reduce the likelihood of such terrible occurrences. For instance, you should make regular data backups. In addition, you need to hold a potent PST fix utility, such as DataNumen Outlook Repair. It can salvage your Outlook data with effortless ease.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including recover mdf and outlook repair software products. For more information visit www.datanumen.com