1376 views

Ensuring that Inbound Email actions always work, regardless of text case sensitivity


Overview


Sometimes an Inbound Email action will not behave as expected, because the string comparisons it uses are case-sensitive, and the incoming email's text does not match upper- and lower-case characters exactly. There are two places where case-sensitive string comparisons are important:

  1. For early product families, Inbound Email Configuration properties that determine when an email should be treated as a Reply or a Forward.
  2. Custom scripts that you write, which contain case-sensitive string comparisons.

 

Procedure for Ensuring Inbound Email Configuration Matches Upper- and Lower-case


This procedure does not apply to:

  • Calgary Patch 6 and later
  • Dublin Patch 2 and later

In later releases, the reply and forward prefixes perform case-insensitive comparisons.

To ensure that the correct inbound action is triggered for emails classified as type Reply or Forward:

  1. Log in to your instance.
     
  2. Navigate to System Properties > Email.
     
  3. In the Inbound Mail Configuration section, verify that the Identify mail as a reply by these subject prefixes property contains a complete list of prefixes that identify that an email is a reply in your company's mail systems. Separate each prefix with a comma. See wiki article Inbound Mail Configuration for more information.
    1. Define multiple versions of the prefix, including mixed-case versions such as FWD:, Fwd:, etc. 
  4. Click Save.
  5. Repeat the procedure for the Identify mail as a forward by these subject prefixes property.

 

Procedure for Ensuring Your Custom Scripts Work with Case-Insensitive Text


If your Inbound Email action scripts contain Javascript patterns similar to the following, then it is best practice to review your code for possible case-sensitivity issues. An example of case-sensitive Javascript looks like this:

Bad practice, because indexOf() requires perfect case-sensitive comparison:

if (yourVariable.indexOf("Incident Opened") != -1) {
   // Do something important here, based on text "Incident Opened"
   // The problem is that "Incident Opened" will not match
}

Best practice:

if (yourVariable.toLowerCase().indexOf("incident opened") != -1) {
   // This will match "Incident Opened", "incident Opened", "Incident opened", etc.
}

Article Information

Last Updated:2016-10-27 08:48:55
Published:2014-04-14