Process email and attachments – tips and tricks

Processing emails or attachments to folders is easy with the Mail Attachment Downloader PRO Client and PRO Server products.  

The feature table on the PRO page provides all functionality available within the product. This post dives into many of those PRO functions to help you automate mundane workflows in your business away. You can click through each of these functions being highlighted here to then dive into those functions in more detail. 


Global Filters and Phases

A key function of PRO functionality is the concept of Global Filters. Global filters lets you configure one or more rules to run every time an email or attachment in an email is processed.  

The program runs through every rule (top down) for every email (if Save as .eml checkbox in the rule is checked) and every attachment. When a rule matches an email or an attachment, the email or attachment is saved, data is extracted using extraction rules and then actions in that rule are run.

Each rule has four phases:

  1. The search phase defines criteria that tells the program whether or not to run this rule.
  2. The extract phase enables you to extract data from the email or attachment and also transform that data as needed.
  3. The save phase saves the file based on the supplied templated filename and folder. You can also use extracted information in the path giving you full control with the directories or filename of the saved file.
  4. And the process phase enables you to run many different actions to automate the workflow.

For more on this, refer to:

Rule Tracing How-To: Troubleshoot rules like a PRO

Troubleshooting Global filters has never been easier. Use Rule Tracing like a PRO to troubleshoot why your global rule filter did not work the way you thought it would.

If you still have questions or issues, see instructions here for contacting support.


Mail server connection setup tips

Links below will help guide you with mail server settings setup.

Still having connectivity or authentication problems? Here are a few tips:

    • Firewall or some antivirus can often prevent the program from directly connecting or authenticating with mail servers. We do not have guidance here for every firewall or antivirus vendor, so check with their documentation and/or contact your IT support to get past this.
    • Search our Knowledge Base for connectivity issues and how to solve them (eg. adding proxy settings in the program)

License activation or moving licenses

    • PRO license activation problems: Search our Knowledge Base for activation tips.
    • Moving license: Moving license from one system or account to another is easy. Just uninstall the program from the old system and move to the new one. You should be able to use the program on both the old and new systems for a short-period (~ a day).

Running for multiple accounts

This blog post explores how you can setup the program to run for multiple accounts simultaneously. This feature is only available in the PRO editions.

READ THIS
https://gearmage.com/blog/multiple-email-accounts-via-rules/

multiple accounts


PDF tips: Save emails or attachments as PDF

With the ability to convert emails to over 50+ formats, saving emails or emails with attachments in a single file or to different formats is a breeze with PRO Server. Note that PRO Client does NOT support converting to multiple formats.

READ THIS
https://gearmage.com/blog/convert-email-attachments-to-pdf/

Convert to PDF
Convert to PDF

Extract data like the Invoice number from an email

You can extract any data using the extraction wizard from the email or body and then use that in the saved filename format.

READ THIS
https://gearmage.com/blog/extract-data-emails-attachments/

extractions-wizard


Save extracted data to a database

Saving extracted data or files to a database could never be easier with the PRO Server.

READ THIS
https://gearmage.com/blog/save-emails-and-attachments-to-a-database/


Nest rules and actions like a PRO

You can nest both rules and chain/nest actions so one is run after the other with the PRO Server.

  • Nest actions (see below)

For example, unzip an email attachment, then run some other actions on the extracted data.

READ THIS
https://gearmage.com/blog/email-actions-unzip-convert-pdf-run-script/

nest actions

  • Nest rules (see below)

Nesting rules can help with reusing rules so you don’t have to repeat the same condition across many rules.

Nesting email rules and actions

Further reading

Some interesting how-to links and posts for further exploration:

Contact us

Contact us if you have any questions, suggestions about the functionality described in this article.

Global Filters – a complete walkthrough

With this post we will explore how you can save emails and attachments to folders using email rules.  Mail Attachment Downloader PRO and Free versions offer excellent functionality to solve these specific needs.

In our earlier blog post, we explored the many ways the PRO products can help you save time and money by getting data out of  emails.

The free version is for personal or trial use and offers some basic functionality to automatically save email attachments to folders.

The free version offers saving email attachments to a single folder. The PRO versions offer the ability to save not just the attachments but also entire emails to one or more folders.

The PRO Server also lets you run these tasks 24×7 unattended on a Windows Server or Azure cloud setup with ease.

Save emails and attachments to folders

The overall concept to save specific emails to distinct folders using our PRO Versions is to create different global rule filters, one per save location.

With each rule filter you would specify which emails to select for that specific rule filter and also specify a save location and filename.

Global Filter Rules overview

A key function available only in the PRO products is the concept of Global Filters.  The Global filters tab offers the ability to create and manage more than one rule.

The rules are run top-down for each download session for the account selected in the Account section in the main program window. You can re-order rules as described in the tips below.

Global filters lets you configure one or more rules to run every time an email or attachment in an email is processed.  Each rule has four phases:

  1. The search phase defines criteria that tells the program whether or not to run this rule.
  2. The extract phase enables you to extract data from the email or attachment and also transform that data as needed.
  3. The save phase saves the file based on the supplied templated filename and folder. You can also use extracted information in the path giving you full control with the directories or filename of the saved file.
  4. And the process phase enables you to run many different actions to automate the workflow.

The blog post will cover each phase separately below.

Rules Tips and common questions

  • Restrict a rule to just one email account: By default, rules aren’t restricted to any one email account: the same rule will run for any selected email account. If you want a rule in the Global filter to only run for a specific email account, you can do so as follows: In a rule (add new filter or edit selected filter), click on the Add -> Filters -> Account matches filter selection and then pick the account  from the dropdown and Save. Do this for each rule you want to restrict to that account.
  • Run rules for multiple accounts: The rules in the Global filters tab is run for the account selected in the Account dropdown in the main window. To run the rules across many accounts, select multiple@multiple in the Account dropdown and then choose the accounts you want to run for. This will run all the rules every time for each selected account.
  • Rules run per attachment / body: For every attachment and/or every body, the program will try to match every rule. Once a match is found, no other rules are run for that attachment or body. Note that other attachments in the email may match other rules based on the filters you have specified in the account.
  • Re-order rules (drag and drop): Rules are run top-down and ordering is important. You can re-order rules by dragging and dropping the rule to the order you want. If an email or attachment matches all filters defined inside the rule, then subsequent rules are not run for that email or attachment.
  • Clone or nest rules: If you find yourself creating many similar rules, an easy way to do this is to select a rule in the Global filters tab and then either double click or click on Edit selected filter. Then change the name of the filter to something different, click Save and choose No in the subsequent popup. Alternatively and this is recommended if you have a lot of rules, you can nest rules instead of copying them.

Create a rule with some filters

Create + Add new filter in the Global filters tab to create a new rule filter as shown earlier. In the rule filter, specify a name for the filter first.

Tips with naming

It is important that you name the rules in such a way that they are easy to find when creating many rules. Choose useful names when naming rules.

Lets say you are running a rule named “Invoices” but you are running this for only one account so you have added a Account matches filter in that rule, then it would be ideal to name the rule “someaccount@gmail.com – Invoices” so it is clear that this rule only applies to someaccount@gmail.com.

Then when you edit the filters in the Global filters, you can search for “someaccount@gmail.com” and only those rules that apply to someaccount@gmail.com will show up.

Search phase

The search phase lets you specify the criteria that’s used to match this rule. The rule will only save the email or attachment and process actions if the criteria matches. Otherwise, the rule is skipped.

Now let’s add a filter to determine which emails to save. In the example below we will filter based on the Subject.

Once the Subject filter is added, you can specify terms such as those containing certain phrases like  ‘Payments’ OR ‘Invoices’.

subject filter added

By specifying OR, the program will search for any emails with Payments or Invoices occurring anywhere in the Subject of the email and execute this rule.  You can also specify AND to ensure one or more terms all are included in the Subject (anywhere in the Subject). Or you can specify NOT to exclude certain emails.

Extract phase

You can also add field extractions enabling you to not only extract data but also transform data and then save them into fields enclosed within curly braces { } (eg. {ORDER_NO}).

extract data - two ways

For more on this, refer to this blog post that’ll go over extraction in more detail.

Save phase: Pick the save location and format

Pick the Save folder and the Saved filename format.

IMPORTANT
In the Save Folder, make sure you are using UNC paths and not mapped network drives when using the PRO Server product. 

Note that the Saved filename format can also include data from the emails like the {ID} or {SUBJECT} or {FROM} or {TO} or {DATE} an extracted field such as {ORDER_ID} and you can include these in the filename.

IMPORTANT
Use {ID} in the filename format:
{ID} is the unique ID given for each file. Ensure {ID} is always present in the saved filename format. Since the program uses multiple threads to download emails and attachments, removing {ID} will cause the program to fail when different emails have the same filename (this happens more often than you think as all email bodies are just named body.eml so if you do not include {ID} then you’ll just get one body.eml file and it would not work as desired).  

You can also specify \ to automatically create a folder based on say the {ORDER_ID} as shown below FY2016-Q3\{ORDER_ID}\{FILENAME}_{ID}{EXT}.

madpro3_saveemailbody

You can also create directories based on who the email was from like in the Free version. All you have to do is to specify something like: {EMAIL_FROM}\{FILENAME}_{ID}{EXT}. This will automatically create a directory for each FROM.

Similarly you can specify {EMAIL_SUBJECT}, {EMAIL_TO}, {EMAIL_CC} and many more. For a full list of options in the program, click the little (i) icon to the far right of the Saved filename format text entry. From the popup you can double click the field you would like to insert into the text area at the current cursor position.

We always recommend adding the {ID} to the filename ensure that files are saved with distinct names even if the name of the files are the same.

You can also save the email (Save as .eml checkbox) that will save the entire email as well instead of just the attachments.

Process phase: Perform actions after save

You can also then perform various advanced actions for each rule after the file is saved. The feature table on the PRO page provides a list of all supported actions and help for each one.

Some examples of actions:

  • Archive emails for further processing
  • Receive invoice data via email and need to save data for invoice processing
  • Save emails and integrate with ERP, EDI, eDMS, eCMS, document management systems or content management systems, eInvoicing invoicing software, Salesforce or medical systems
  • Use our PRO SDK (Software Development Kit) to integrate directly with your LOB applications.
  • Save emails or Excel or CSV attachments sent via email to an in-house or cloud database for further processing
  • Convert emails to PDFs or multi-page TIFF or over 50+ formats or merge/split PDFs including attachments to hand-off to other document management systems or medical software
  • Run custom in-house scripts after extracting attachments
  • Auto-respond or send email notifications when certain types of emails or attachments arrive and then take other actions

Create multiple rules for different folders

Create multiple rules to match different emails and save them to different folders.

Uses and scenarios

Many businesses today use legacy extraction products to get data out of emails into folders (magic folders). Various other backend processes then pick up these files automatically to process them such as Scanning products, Invoice processing or invoicing related products, Document indexing products, Document archiving/management products,  OCR products and many more.

Further reading

Some interesting how-to links and posts for further exploration:

Contact us

Contact us if you have any questions, suggestions about the functionality described in this article.