Email Manager text parser overview

Email Manager text parser overview

Email parsing allows you to scan the contents of an email, or text-based attachments of the email and look for, and extract text according to “parsing” rules that you configure.  Extracted text can then be used to update different parts of the job (details, priority, job type etc), update a job, run scripts, or even create a new client.  You can create multiple parsers per Email Manager profile.  A parser is simply a set of text processing rules that you define to extract text from a bigger block of text.  Once a parser runs, any extracted text can be transferred into a HelpMaster job, or stored in a variable for additional parser processing.

Email parsing is very useful for structured email - such as those sent by network monitoring tools, and other automated email.

Example parser

Suppose you get an email that includes an SQL Server version string that looks like this:

Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64) Apr 2 2010 15:48:46 Copyright (c) Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 6.1 <X64> (Build 7600: )

As part of the email processing, you want to extract the following 3 things from it:

  1. The SQL Server version

Microsoft SQL Server 2019 (RTM-CU6) (KB4563110) - 15.0.4053.23 (X64) Jul 25 2020 11:26:55 Copyright (C) 2019 Microsoft Corporation Standard Edition (64-bit) on Windows Server 2019 Standard 10.0 (Build 17763: ) (Hypervisor)

  1. The Windows version

Microsoft SQL Server 2019 (RTM-CU6) (KB4563110) - 15.0.4053.23 (X64) Jul 25 2020 11:26:55 Copyright (C) 2019 Microsoft Corporation Standard Edition (64-bit) on Windows Server 2019 Standard 10.0 (Build 17763: ) (Hypervisor)

  1. The build number

Microsoft SQL Server 2019 (RTM-CU6) (KB4563110) - 15.0.4053.23 (X64) Jul 25 2020 11:26:55 Copyright (C) 2019 Microsoft Corporation Standard Edition (64-bit) on Windows Server 2019 Standard 10.0 (Build 17763: ) (Hypervisor)

To do this, you would create 3 parsers - each one targeting a specific area of the original text. 

Configuring the parser

  1. From the Email Manage profile’s Email Parsing step, click Add to create a new parser item and then from the the Content Source tab, where you wish to extract the text from. In this example it’s the Email Body

Content Source : The parser will scan whatever you select here. Refers to one of the following source fields:

  • Email body - Use when the text you are looking for is contained within the body of the email
  • Email subject - Use when the text you are looking for is contained within the subject of the email
  • Email Sender - Use when the text you are looking for is contained within the senders email address of the email
  • Email Attachment - Use when the text you are looking for is contained within a text-only attachment of the email.  See Attachment parsing
  • String Builder - Use when the text you are looking for is contained within a custom-made string (text) that you have configured.  See String Builder Email Parser
  • Script - Use to create advanced database/SQL scripting options. See Script based Email Parser
  • Variable - Use when you wish to run a parser over an existing variable that was previously created by a parser. This is useful for complex, or multi-layered parsing. Think of this feature as parsing the results of a parser.

  1. On the “Email Parser Item” tab, define the parser details (see below for an explanation of each setting)

 

Parser Name : A unique name that identifies this parser

Description : A short description of what the parser does

Destination : When the parser successfully extracts text from the source, the destination will store the extracted text.

  • Job Field The extracted text will be inserted to the job field that is specified in the Job Field drop-down box.

  • Control set The extracted text will be inserted into the control set field that is specified from the Control Set drop-down boxes.

  • Action Field The extracted text will be inserted to the action field that is specified in the Action Field drop-down box.  Use this option when updating an existing job from an email.

  • Variable (Name = Parser name) The extracted text will be stored in a variable.  The variable name is the same name as the parser name.  Once a value has been stored in a variable, it can then be used as the Source for another parser.  This may be useful for advanced text processing requirements as it allows you to break up text into smaller units, which can then be re-parsed for further information.

  • Client Field The extracted text will be inserted to the client field that is specified in the Client Field drop-down box.  Use this option when you wish to create a new client as part of the job logging process.

  • Note! If the same destination field is selected for multiple parsers, the last parser to be processed will overwrite all previous values.  If you need to preserve the individual values for each parser value, you will need to set the destination for each parser to use the “Variable (Parser name)” option, and then use the String Builder to build up your text values and set the destination value from the String Builder.

Find Start :  Define how to find the [start] of the text you wish to extract

  • Use Search Text : Enter the exact text that will mark the beginning of the text you wish to extract.

  • Regular Expression Search : Enter a regular expression that will mark the beginning of the text you wish to extract

  • Beginning of Source : This option does not require you to enter anything.  Parsing will start at the very beginning of the text as specified in the source option. 

  • Beginning of Line : This option does not require you to enter anything, and relies on the options you specify in the “Find End” section.  When the parser finds the end-text as defined in the “Find End” section, the "Beginning of line" option will extract all of the text from the beginning of the line that the “Find end” parameters were found on.

Find End : Define how to find the end f the text you wish to extract

  • Use Search Text : Enter the exact text that will mark the end of the text you wish to extract.

  • Regular Expression Search : Enter a regular expression that will mark the end of the text you wish to extract

  • End of Source : This option does not require you to enter anything.  Parsing will end at the very end of the text as specified in the source option. 

  • End of Line : This option does not require you to enter anything.   Parsing will end at the end of the line of the text as specified in the source option.

  1. Test your email parser with some sample text

Notes

Targetting the job summary, or job details will replace all of the information in these fields.  Use with care.

See Also

Attachment parsing

String Builder Email Parser

Script based Email Parser