Jump to content

Email Interrogation


Recommended Posts

I was wondering if after an email is logged is there a way to interrogate the source email to take out some information and place into a custom field.

Example email:

Dear Officer,

Please can help me do a thing

username: xxxxxxxxxx

Kind Regards

Jon

Is there a way to grab the x's so that we can get the username and then put that username into a custom field within the request?

  • Like 1
Link to comment
Share on other sites

Also - how have you "logged the email"?

By default, a Request raised from an email source (either Mailbox or Auto Responder) will have the email body in the Description, which you can easily access and pass to the string utilities.

Link to comment
Share on other sites

13 minutes ago, Jeremy said:

how to use the string utilities

Which part are you needing documentation on?

If it's the 

23 minutes ago, Jeremy said:

Is there a way to grab the x's so that we can get the username and then put that username into a custom field within the request?

part that's about constructing a REGEX query and not something Hornbill would be documenting - you'd need to check out one of the many REGEX tutorial sites for that.

If it's about general configuration of the nodes that would be something we (Hornbill) could help with.

Link to comment
Share on other sites

On 3/30/2022 at 3:20 PM, Steve Giller said:

Which part are you needing documentation on?

 

I can't find documentation on the string utilities and examples from a Hornbill perspective to show what these functions can do.

e.g. With the Trim option where do you enter how many characters to trim etc

Link to comment
Share on other sites

@Jeremy we don't have detailed wiki documentation for these utilities. They are somewhat intended for more advanced use so the naming indicates to some degree as to what the function is intended for. In any case we do document how use each function, this documentation (which is contextual) can be accessed via the ? (question mark) button when configuring the node. Example for the "trim" function:

image.png

Link to comment
Share on other sites

  • 2 weeks later...

Hi @Jeremy

The first issue with trying to extract information from an email using regex is that if the emails are manually written, there are so many ways that this could go wrong.   If the email was submitted using a web form where you know the email is going to follow a set layout, this would be easier.

The key Hornbill Automation is the String Utilities -> Regex Match.

For the input text you can use the Get Information -> Source Email Details task.  This can then feed into the Input Text  as seen in the image below.

image.png

The Regular expression (?<=username: )[a-z]* is in its simplest form and would need a lot added to it to consider different variants that someone may write.  This expression will locate the text username: (including a space after it).  It is then looking for any word that follows which will then be placed in the Results outcome, assuming that your usernames only include letters from a to z.  If someone adds no space or more than one space, or they make a spelling mistake on "username" if has the potential to fail.  One could continue to extend this regular expression to include further variations of the text that may be provided.  The regular expression flag g is for global which just sets the match to look through the entire multiline text for the string "username: ".

After the Regex Match automation, you could then follow this with the Create User Automation, using the variable for the Result outcome taken from the Regex Match automation.

I hope that makes some sense.  

 

  

 

image.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...