Linking specific emails to specific explanations

Linking specific emails to specific explanations

Most kinds of receipt emails arrive regularly, perhaps monthly, and each one is uploaded to the next suitable bank transaction explanation. In your attachment rule you specify which emails to upload (by subject and/or body) – and which explanations to attach them to (by description).

Sometimes, though, you don't know for sure that the receipt emails will arrive in the same order as the bank transaction explanations. In this case you can get DoubleAgent to extract a specfic piece of information, such as an email address or reference number, from the email and use it to find the corresponding explanation which contains that piece of information.


Let's say you sell via an online service which emails you an invoice PDF for each sale and you want to upload each PDF to the corresponding bank explanation.

If you only have one sale per week, you can be sure that the receipt emails and the corresponding bank transactions will appear in the same order. Therefore you can look for suitable bank transactions using generic text found in all the service's transactions' descriptions, e.g. "Nifty Product sale notification".

However, if you have many sales per day, the receipt emails could well arrive in a different order from the bank transactions. To link a specific email to a specific explanation, you'll have to look for bank transactions using text specific to each email, such as an order number.

Extracting and matching email-specific text

The magic happens in your attachment rule's Description includes field for bank transaction explanations.

You use double quotation marks to indicate any parts to be taken from the receipt email. Inside the quotes, describe the text to be matched, using a "matcher" (see below), and extracted. DoubleAgent will extract that text from the email and then replace the quotes with that text.

For example, let's say you have emails which contain text like this:

  • Congratulations! You have an online sale for customer - your invoice is attached.
  • Congratulations! You have an online sale for customer - your invoice is attached.

And you have bank explanations whose descriptions look like:

  • Nifty Product sale notification
  • Nifty Product sale notification

In your attachment rule, you start with a Description includes of:

Nifty Product sale notification ""

Now inside the double quotes we describe the text we want to extract from the email. We use a "matcher" (see below) to capture a part of the text, and typically we surround it with known words to anchor it.

In this case we could write:

Nifty Product sale notification "sale for customer {{}}"
  • The sale for customer tells DoubleAgent where to start matching in the email text.
  • The {{}} is a matcher which captures a single word.

The end result is:

Email text contains...Explanations matched
Online sale for customer jane@example.comNifty Product sale notification
Online sale for customer joe@example.comNifty Product sale notification


There are a couple of matchers you can use:

MatcherWhat it matchesUse when you want to:
{{}}A single word...extract a single reference number or email
{{+}}One or more words...extract several reference numbers or words