This is how to create a Variable that matches a sender emails address to an item inside a Dataset so it can return it's value.
An example use of this capability is when you would like to file emails using the sender's email addresses to a folder corresponding to the sender's company. For example, email from bob@acme.com filed to "Acme Inc." folder.
If you are not familiar with variable creation please read Variable creation first. Also we suggest you to read this pattern testing article and our regular expresions article.
Dataset
This is the dataset that we will use to test this variable example.
This dataset is based on a domain-corporation relation.
Case 1
We will search in the Sender matches for .*@corp.mxhero.com (This regEx will match any sender that finishes with @mxhero.com) then it will check if the dataset selected (Corp) has a key named corp.mxhero.com, if it does it will convert it to the value of that key, in this case 'mxHero'
Testing Case 1 conditions
To test this case we'll set a single value metakey for testing purposes.
Click on test button
The test result is divided in three parts:
- An "easy to read" pattern
- The result of the matched Sender converted
- The groups found (In this case it is only one group ${0}, and it is the entire matched Sender)
Case 2
Now we will try to match the regEx (.*)@(mxhero.com) in the email message part Sender (this will find any string finishing with '@mxhero.com' and it will separate it in three groups delimitated with parenthesis).
Then it will search the group 2 (${2}) in the keys of the selected dataset (Corp) converting it to 'mxHero', that it is the value of the found key.
Testing Case 2 conditions
We'll set a single value metakey for testing purposes.
Click on test button.
Test shows almost the same output that case 1 but it has different groups (Pattern and result):
- group 0: Entire string found
- group 1: (.*) any character before @
- group 2: (mxhero.com) after @
RegEx: (.*)@(mxhero.com)
According to the aforementioned results it found the string 'mxhero.com' in {Sender} (${2}) that matches with a Key in the dataset Corp and it converted to 'mxHero' that is the value of the matched Key.
Comments