Customizing filenames or email data using fields

Mail Attachment Downloader PRO versions offers you flexible file naming and extraction capabilities. This post explores how you can use the fields helper to customize filenames and fields used within the program.

How to open the fields helper

Fields helper button next to many text fields in the Rule filter window

The little [i] button (see screenshot above) next to many text input fields offers you the capability to pop-up the fixed fields helper dialog.

Fields helper popup

Fixed fields are those that are built-in to the program (see screenshot below).

Fields helper pop-up

Customizing fields output

Most text fields are pretty straightforward and are self explanatory.

Some text fields offer you the ability to customize the output. Below you will find all such fields available in the fields helper.

  • ATTACHMENT_COUNT[‘.pdf’ OR ‘.xml’]
    You can specify the specific filename/extensions such as ‘.pdf’ OR ‘xml’ and include other extensions that you see fit. You can then use this in the rule to filter out emails that the rule applies to.
  • Dates formatting – DATE, DATE_LOCAL, DATE_UTC, PROCESSED_DATE, PROCESSED_DATE_LOCAL, PROCESSED_DATE_UTC
    Each of the date fields offers you the ability to customize the date format specified within square brackets []. Example: DATE[yyyy-MM-dd] will end up formatting the date part only excluding the hours minutes and seconds from the date. For a full reference of what you can specify within the square brackets see here.
  • EMAIL_HEADER[FROM]
    Email header field offers the ability to selectively pick out a certain email header field by specifying them inside the square bracket.

Examples of customization

Many email download actions such as the following: Save .csv metadata, Merge PDFs also support the ability to append to existing files if they exist.

Example-1: A running daily log of all attachments downloaded

So for example, if you wanted a running daily history of all files that were saved and the email metadata for those files in a csv, you can do so by clicking the Save .csv metadata action and then specifying the PROCESSED_DATE_LOCAL[yyyy-MM-dd] with the date field truncated to just the day will enable the action to append to the same file.

Example-2: Merging all PDF files and keep a running log for the day

Fields helper button next to many text fields in the Rule filter window

We hope that this post provides you an insight into more of the powerful functions enabled by the program.

Support for modern authentication in Outlook-IMAP, Exchange and Google

Microsoft announced that basic authentication will be discontinued in their products starting October 2020. Google had a similar announcement in the same year. This applies to both Office 365, Exchange and Google, GSuite accounts.

To cater to this, v3.2 build 1049 introduces full support for Microsoft based second factor authentication (OAuth) and Google’s second factor authentication OAuth for cloud-based or hybrid environments.

This new build now includes support for modern authentication for these types of mail servers:

  • IMAP to Outlook/Live
  • Exchange (non on-prem deployments)
  • Google OAuth

Shown below is an example of a popup using Microsoft authentication. The program currently triggers this popup only if the following are met:

  • Basic authentication fails to work (tries basic by default always)
  • Password is incorrect

Need to move away from Basic Auth? If you are trying to move away from Basic authentication or are trying to force the program to not use it, we suggest you enter the wrong password and if you try to test the connection after that, it should popup the ability to use the second factor auth. Note that you need to be on v3.2 build 1048 for this to work properly. That will work provided your admin has configured support for this new form of authentication.

If you received the error the Autodiscover service couldn’t be located, please check this KB article for possible ways to mitigate this.

The screenshot below captures what this popup will look like…

Initial popup asking for credentials in a browser popup.
Requests access for email access.

If you received any errors at this stage, it likely means that the admin has not given this program permissions to access the specific scopes that are being requested (eg. EWS.AccessAsUser.All for Exchange/O365). Please contact or check online on how to change permissions to do so.

Once you have proceeded through the prompts you can click on Connect and Download to save the credentials. If you want to delete the account or the credentials you can click on the delete account button in the main program window.

For Exchange online or Office 365 accounts, we recommend going with the following default server settings.

Exchange online or Office 365 settings

There is a new checkbox in the settings above On-prem ONLY and we recommend leaving that unchecked. If you check that box, then there will be no popup requesting credentials.

That’s it!

Again, we encourage our users to contact support@gearmage.com if you have any feedback on authentication issues you may be having.

Nesting email rules and actions

Latest builds of v3.2 provides new capabilities such as nesting rules or actions. Make sure you upgrade the build to the latest before you proceed to read through this blog post.

This blog post explores how you can nest rules or nest actions like a PRO.

Nesting rules

Preface – Processing emails with Global filters offers the ability to save emails or attachments into different folders based on some criteria and take actions on them.

You do not need to learn about nesting (described here) for most common cases. Nesting is only useful for advanced cases.

If you are not familiar yet with the Global filters, we have a great blog post here that should help you get started.

Proceed to read on only if you are familiar with how Global filters work.

STOP here and read through this blog post to familiarize yourself with Global filters

This post is about how nesting rules can come in handy when you want to cover some advanced scenarios. Some examples where this can be useful include:

  • When no rules match for a specific email, perform certain actions such as move emails to an error folder that you can take a look at.
  • When you may have multiple attachments in an email each of which have different possible actions.
  • When you want to share a set of actions or email filters amongst many rules so you don’t have to re-type them all over again.

The global filters tab in the PRO versions offer you the ability to define three types of rule filters: an Email Filter, a Global Rule or a Negative Rule, Shared Action. The Rule Type dropdown (shown below) enables you to select the type of the rule.

Read on to explore the different rule types below by using an example.


Tutorial with an Example….

Example: Consider an example where we want to target all emails that have the term “Invoice ID” in the Subject. We also want to move the .pdf’s in such emails to a PDF prefixed folder and .doc’s in such emails to another folder prefixed by doc. Also, if no pdf or doc’s are present, we’ll move the email to an “Issues” folder. And lastly we want to use a Shared Action to save the doc/pdf related email header data (from/to/subject etc.) to a database.


Rule types in an email rule
Different Rule Type’s in a Global filter rule

Let’s start by creating a new Email Filter.

Go to the Global filters tab and Add new, in the popup select the Rule Type as shown above and change it to Email Filter if it’s not already selected.

Email Filter: This enables you to instruct the program to filter processing to either a specific email or to target a group of emails matching the filters you specify here. This rule does not, in and of itself, enable you to save emails or attachments to folders or even define actions that you can take after saving files. Those sections will show up disabled as a result.

Read on to see how Email Filters can have Global Rules as child rules…
An Email Filter that matches emails with the Subject containing “Invoice ID”

You can then save this rule and it’ll show up in the Global filters tab as shown below.

Global filters tab showing one Email Filter

Global Rule: This type of rule enables you to specify which attachments you want to filter down to and where to save them. It also enables you to define actions that you can take after saving the file. You can define a Global Rule as a standalone rule (at the root level) or as a child of an Email Filter.

Read on to see how you can setup multiple Global Rule‘s to save files to different folders

To create a Global Rule as a child of an Email Filter, right click on the email filter and add a new Global rule as shown below.

Add a new Global Rule as a child of the Email Filter defined earlier

Let’s have this rule save the email attachments that are PDFs to a “PDF” folder. This has a filter of Attachment count greater than and a filename option of pdf.

Global Rule that saves PDFs to a prefixed folder pdf\ as highlighted

Since this is a “child rule” of the Email Filter we defined above, the Global Rule will only run for emails with a subject that contains “Invoice ID” that we defined earlier. We have also setup a Mark as read action as shown above. You can add any other action like Move email to folder to move the email to a different folder if you want.

Global filters showing Global Rule that’s a child of the Email Filter

Now, let’s define another Global Rule that saves .doc or .docx’s into a different folder. Right click again on the Email Filter in the Global filters tab and select Add new -> Global Rule. Setup the Global Rule as shown below.

Global Rule: Save docx or doc extension attachments to a doc\ prefixed folder

At this point you should see Global filters tab as shown below (Email Filter being the parent with two child Global Rules).

Negative Rule: This type of rule lets you specify “catch-all” actions when none of the Global Rules match. To do this, we will right click on the Email Filter again and select Add new -> Negative Rule. This type of rule doesn’t offer you the ability to save anything (this will show up disabled).

Read on how to setup a Negative Rule under an Email Filter as a “catch-all” rule
Adding a Negative Rule

Let’s now configure the Negative Rule to copy the email to the “Issues” mailbox folder.

If no Global Rule‘s match for this Email Filter, move email to the ‘Issues’ mailbox folder

Lastly, lets create a Shared Action. Go to the Global filters tab and right click anywhere (not on the Email Filter like we did earlier as Shared Action will show up disabled if you do that). Then select Add new -> Shared Action.

Shared Action: This type of rule has no save options enabled but will have additional filters or actions that you can define. These actions are those that you want to share amongst many Global Rules.

Read on to see how to use a Shared Action to save email data to a DB

We’ll create a new Shared Action as shown below.

A Shared Action to save email data to a database

To configure the program to save to a database, refer to this blog post. We won’t show that here.

Now let’s add this Shared Action to the Global Rules we defined earlier. Multi-select the two rules in the filter tab and then right click and select Add ‘Shared Action’ to selected option as shown below.

Add a Shared Action to selected Global Rule‘s

In the popup that follows, select the shared action we called “Save emails to a database” and click OK.

That’s it.

Summary of the final setup for the example

Now we have setup rules to process the emails with the Invoice ID in the Subject with the Email Filter. Then configured child Global Rules to save PDF and DOC attachments to different folders. We also defined a Negative Rule that moves the email to an ‘Issues’ folder when no attachment arrives. Lastly, we configured a Shared Action for the Global Rules to save the email data to a database.

Nesting rules are a great way to take advanced actions

Nesting actions

Similarly you can nest actions inside a rule as shown below after saving the attachment.

The below shows how you can unzip a file, do a document conversion and then save to a database and run a command line operation.

automate email actions: unzip_files
Nest actions inside a Global Rule or a Shared Action

For more on this, read this blog post here.

Why did my rule not download the attachment or email?

This post will go over common troubleshooting steps to help you set up the correct email rules to get the behavior you want.

First off, this post only covers the PRO versions in depth. For the free version, refer to the free download page for instructions.

The assumption for the rest of this post is that you are using the global rules tab to setup the download.

So global filters are critical for the best use of the PRO Client and PRO Server versions. If you have not already setup global filters or rules, the recommendation is to do that as soon as possible.

Here are a few blog posts to help educate yourself about the PRO product and the use of global filters:

    1. IMPORTANT (READ THIS FIRST): Setup global filters for your email attachment processing. Learn about filters, extractions, save locations and actions inside a rule.
    2. If you work with multiple email accounts, learn how to set them up using global filters — multiple email accounts setup
    3. Configure the rules to save email bodies or attachments as PDF or other formats. 
    4. Understand the intricacies of setting up rules to extract data from emails or attachments. Then use that extracted data in actions.
    5. If you work with databases, learn how to save or read data from a database and use them in your actions.
Bookmark the tips and tricks page for tips on how to use the program.

Why did my rule not work?

To answer this and/or other questions like why the rule did not download the attachment or email, enable Rule Tracing.

The best way to troubleshoot any rule is to enable this new feature we have introduced called Rule Tracing. So rule tracing helps you  trace through what happened when a connect and download was initiated.

Rule tracing walks you through how the program decided to process the emails. It helps you understand which rules matched or did not match for every email or attachment that was processed!

Latest build

Only the latest build (v 3.2.1015 or later) has this new Rule Tracing functionality. So make sure you upgrade to this latest build.

Upgrading is easy. All settings are always preserved while upgrading.

NOTE for PRO Server users:  If you are running a service, uninstall the service from the Service tab first. Not doing this may interrupt the installation of the latest build.

  • Free instructions — If you are using the free version, just go to our website to get and install the latest build.
  • PRO instructions — If you are using the PRO versions, use the SAME link that you received in your license email to install the latest build. Your settings will be preserved with the upgrade.

How can you tell which build you are on?

To check the build you currently have, hover the mouse over the main title text (i.e. “Mail Attachment Downloader”) in the main program window.

version and build

You should see a popup with the version eg. 3.2 and the build 3.2.955.0 (955 is the build) as shown above.

How do you enable rule tracing?

It’s easy, just go to the Global filters tab and check the Rule Tracing checkbox (see the red text box highlight).

rule tracing

The search icon next to the Rule Tracing checkbox will not show anything until you run a Connect And Download session.

IMPORTANT: Before running a trace…

To make sure the program has a chance to process all email, do the following:

  • Uncheck the Exclude inline attachments checkbox inside every Global Rule that has the control enabled
  • Go to Global Filters tab -> Search in ->
    • Select Messages Since Last Download radio button if you are SURE there is new email that meets the criteria
    • Select All mail radio button to scan all email from the start of time. The program will then scan all email (this setting will apply for every account).
  • Check the Inline content button

Running a trace…

Once you have enabled rule tracing, you will need to run a connect and download to test it out.

But before we proceed, a little advice for PRO Server service users follows…

  • If you are running the PRO Server and a service, uninstall the service  first so you can troubleshoot the issue using a normal connect and download.
  • If you are having troubles with the service itself and the connect and download is working fine here’s what to do. The most likely cause for this is that you have not uninstalled and re-installed the service from within the program after changing some configuration. Config changes only take effect in the service after uninstalling and re-installing the service from within the program’s service tab.

Before running a connect and download, we recommend setting up the rules so you focus on the problematic email or attachment. To do so, you may need to disable certain rules (right click and disable them).

Or you may need to change the Search criteria (Search in… section) to All mail and alter the dates (Search between dates… section) when you want the program to process emails.

This way when you run the connect and download we won’t process all emails again but will just focus in on the specific email or attachment you want to troubleshoot.

Now click Connect and Download to initiate the trace and let it finish.

Analyzing the trace…

Once the connect and download has finished, switch back to the Global filters tab. Then click the Search button small search button next to the Rule Tracing checkbox.

This should bring up a popup window something to the effect of the below.

Email Attachment trace view

Now lets look at how to analyze the information presented in this window.

Step-1: Select the download session based on time shown that you want to analyze.

Trace view - step 1

Step-2: Select an email that should have downloaded emails or attachments or should have run rules or actions and you think there’s an issue with it.

Trace view - step 2

Step-3: Look at every part or attachment of the email and drill down into which rules ran and which rules matched or did not match and why.

Trace view - step 3

That’s it!

NOTE: Rules are run ordered from top to down (in the order they show up in the Global filters tab). So if a rule matched, no more rules under that rule will run.  You can change the ordering in the Global filters tab by dragging and moving a rule around.


With this you should be able to find out why one or more rules did not download any attachments. And then you should be able to tune the rule configurations to ensure that it does what you want it to do.

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.

New Filter Features in PRO Server v3.2 build 978

Mail Attachment Downloader PRO and PRO Server editions offers email filters to configure the program to process emails and attachments in different ways.

This gives an introduction to Global Filters and explores some of the new features introduced in  PRO Server v3.2 build 978.

Overview

For an overview of how to save emails and attachments in specific folders please refer to this post before reading through this one.

What are global filters?

The global filters are a set of rules you can create in the Global Filters tab as shown below. This is only available in the PRO and PRO Server editions of the product.

Global filters apply to all configured accounts in the program (under the Account dropdown).

Note that to download from multiple accounts, you must pick ‘multiple@multiple’ from the Account dropdown. Otherwise the download will only run for a single account.

When is a global filter run?

For each attachment, a global filter is run to see if any filters you have specified within match that particular attachment.

How to make a Global Filter apply to a single account?

By default, global filters run for all selected accounts (when you select multiple@multiple from the Account dropdown in the main window).

You can make a global filter apply only to a specific account by editing the rule and then clicking Add -> Filters -> Account filter as shown below.

Screen Shot 2017-04-27 at 1.55.35 PM

This will make that rule run only for that account. Once you have clicked Save, this will also show up in the main list.

Moving rules

Each rule is run for every attachment from top down until a matching rule is found. The ordering of the rules in the global filters tab is important.

Once a matching rule is found for a specific attachment or body, then NO other rule is run for that attachment or body. If the email has other attachments, then all rules are checked again.

To move one or more rules, just drag and drop the rule or rules in the Global Filters tab.

Catch all rule, send auto-response

If you want certain attachments to be processed, then define global rules for those. But what if none of them matched?

Since filters in the global filters are run top down and ordering matters, you can now define a catch all rule towards the end of the global rule filters list.

This last rule will run when none of the rules above it have resulted in a successful match or download.

That way, you can, for example, send an email to the sender indicating that their email did not contain the requested attachment or data.

Enable / Disable specific rules

You can now enable or disable specific global filter rules. Just go to the global filter tab and then right click on one or more rules and then Enable or Disable them. Disabled rules will never run.

Setting download dates

The program starts downloading messages from an account from the start of time if it had never run a download from that account before. This is true even when Messages since last download was checked in the Search or Global Filters tab.

Screen Shot 2017-04-27 at 1.58.00 PM

If you want to change this behavior, you can set a Start Date above and also switch to Messages since last download in the Global filters tab.

What this does is that for each account selected in the Account dropdown (or multiple accounts when using multiple@multiple selection), the program will only download messages from that start date onwards and will only check for new messages that have not been downloaded or processed by the program.

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.

Save csv, excels to a database

If you have a need to save csv or excels to a database, you can automate it with ease with Mail Attachment Downloader PRO Server.

If you already receive these csvs or excels on email, then great we will show you how to save these to a database.

If not, you can email these csvs to an email address of your choice and have the program extract the attachment and automatically save it giving great power to you on-the-go.

Save csv, excels to a database

First ensure that you have a database connection configured as instructed here.

The next step is  to create a Global rule filter so we can first identify the email that contains the csv, excel. You can do so by adding a rule filter as shown earlier in this blog post. You can also specify a file type filter to choose .csv or .xls or .xlsx emails with filtering rules.

Once those are both done, saving the csv or excels to a database requires you to add an action.

  1. Click Add action -> choose Extract csv and save to DB and then click the Load sample file button to load a sample Excel or Csv file.csv to db - load sample
  2. Pick the sheet from the Choose sheet dropdown you want to load data from.csv to db - sheet
  3. Click the Load column names from sample file button. This will load the column names as cell id’s (eg. A1, B1 etc.).csv to db - load columns
  4. If your Excel/Csv starts from a header row (with header titles for each column), check the Starts from a header row and then click the Load column names from sample file again. This will auto-import the column names for easier manageability.csv to db - load columns with header row
  5. For each column you want to import, specify a field name within {} as shown below. By default all fields are imported as VARCHAR’s. If you want to change the type, you can also choose Extraction Wizard for this field to change the field type or manipulate data from the Csv if needed.Csv to db - field name
  6. Once all fields have been given a name within {}, click the Insert into database tab. Pick the DB source you have already configured and the table name you want the data inserted into.csv to db - table name
  7. Now specify the SQL including fields that you want inserted as shown.INSERT INTO {TABLE_NAME} (‘Sales description’, ‘Sales price’, ‘Sales quantity’) VALUES ({DESCRIPTION}, {PRICE}, {QUANTITY})csv to db - sql
  8. Now click the Test SQL using Sample File button. If everything is correct, then you should see something like the below. You can then look at the database to ensure that the rows from the Excel or CSV were inserted into the DB. csv to db - success

That’s it.

Now any emails matching the criteria would end up being added into the DB.

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.

 

PRO features: multiple email accounts and rules

The Mail Attachment Downloader FREE versions offer the ability to download emails from only a single email account at a given time. Furthermore, you are restricted to only a single search or filter criteria.

We will explain how the Mail Attachment Downloader PRO versions differs and overcomes these limitations below with the PRO Features: multiple email accounts and rules.

Multiple email accounts

With the free version, you can run a download session for a single email account at a time. To download from another account you will need to pick another account from the Account dropdown.

With the PRO version, you can select multiple accounts  by selecting <multiple@multiple> option from the Account or email pulldown as shown below.

This will bring up the multiple account chooser after which you can select multiple email accounts that have already been configured.

multiple email accounts

Note that prior to selecting these accounts, you will need to add these accounts to the Account list first as individual accounts and then select the <multiple@multiple> option to choose multiple accounts.

Once selected, when Connect and Download is clicked, the program will download emails from multiple emails automatically.

If you have the PRO Server version and you want to download from multiple email accounts in the background, just select <multiple@multiple> first and then go to the Service tab and then click the Install service button.

Multiple email rules

The FREE version only let you specify a single email rule per email account. For example, you could search for emails starting from a certain date (search tab) and also include a Filter (filter tab)  by Subject. This will download all emails from that date that also match the Subject you provided.

This setting is saved per email account. When you switch accounts, you can specify a different search and filter setting that will be remembered for that account.

But what happens when you want to download this Subject to a folder and maybe a completely different email with a different Subject to a different folder and perhaps also run some actions after downloading the file?

You can do so with the Global Filters tab in the PRO versions as shown in the screenshot below.

IMPORTANT:

The global filters tab lets you add one or more rules (order matters).

Ordering: For every attachment (or .eml if Save as .eml was checked), the program scans rules from topmost down (rule by rule) and checks to see if a rule matches all the criteria. When a match is found and a file is saved, no other rules below it are run for that attachment. Note that other attachments in the same email or body (if body hasn’t been saved already) will scan all the rules again from topmost down to find a match for that attachment/body.  Enable and use rule tracing to find out how or why an attachment or a body did not match a rule.

Applies to all email accounts: These rules apply to all accounts you have defined in the Account dropdown by default.  That is, each rule defined here, by default, will apply and run for every download session regardless of the email account that was selected/used to run the download.

You can, if needed, make the rule run only for a specific email account by adding an Account filter as will be explained below.

When using global filters, certain settings in the Search and Filters tab that were set for individual accounts will no longer be used and the UI for these will be disabled.

This is because the Global filters take precedence over the individual settings specified. You can specify the same exact Search or Filter criteria via a global rule as will be shown below.

To replicate the search and filter settings that you had in your free version in the PRO version, the first step is to click Add new filter and enter a rule name for the new filter. Below we’ve entered then name as ‘Payments FY 2016 Q3’ as an example.

rule filter

IMPORTANT 

Account specific rule: If you want this rule to only apply to a specific email account and not all accounts, you should  specify a filter.

In the filters section of the Rule window, click Add -> Filters -> Account and choose the account from the dropdown (see screenshot below, choose Account instead of Header: SUBJECT).

Not doing so will mean that this rule runs for all accounts.

To add the Subject filter (that was previously in the Filters tab), click the Add button below the filter name in the Rule filters and extractions section and click on the Filters sub-menu followed by the Email Subject sub-menu item.    

This will add a new Subject filter to the Filters list as highlighted below. You can then enter the Subject you want to search much like you could have with the Filters tab in the main program window. Click on the Subject text box or click the … button next to get a help on how to specify this filter.

subject filter added

There are three ways you can specify a “match” in Mail Attachment Downloader PRO in almost any field that does a match (Subject, From, To, etc.).

  1. No quotes: In the field if you just specify Payments without quotes, then it will do a substring match. If the word Payments appears anywhere in the Subject it will be a match.
  2. With quotes: Including quotes like ‘Payments’ will do a regular expression match. If it’s just ‘Payments’ with the quotes it will do a substring match just like in (1) above. You can test out the regular expression by clicking the … button to the right of the text input area as shown above.
  3. With quotes and logical operators: You can also include logical operators such as OR, AND, NOT to combine multiple quoted matches. So an entry like ‘Payments’ OR ‘Invoices’ will match any subject where the words Payments or Invoices appear anywhere in the Subject (i.e. a substring match). You can also use parentheses to group these like: NOT (‘Payments’ OR ‘Invoices’) AND ‘Sales’ will match just Sales and not Payments or Invoices.

Use the button to test out your match criteria for any field to see if that is what you want.

Similarly, you could add other filters like by File type filter. 

Click on the Filter file types list item in the list box below the Add button to reveal the file types you want to select. Example below shows how we can filter by file type of Documents. You can add your own in the Other section (comma separated, like .csv, .jpg etc.).

filter by file type

Extractions

Similarly, you could also extract data from any email header or body or attachment once the subject and file type matches if you would like as shown below.

Click Add -> Extractions -> (pick the wizard or regular expression option).

extractions

For more about extractions, check this in-depth guide on how to extract data from emails and attachments.

Choose save filename or format

Once you have the filters and extractions setup, you can pick the filename format as shown below. Click on the little information button next to the filename format to see a list of templates (enclosed between { and }) to include in the filename.

Save filename and format

CUSTOM FOLDERS: You can also include a \ in the Saved filename format field to indicate that a folder needs to be created. The program would automatically create a folder here whenever needed.

For example, {EMAIL_FROM}\{FILENAME}_{ID}{EXT} would create a folder for every senders emails address. This will be automatically created when a new attachment is downloaded.

Click the [i] information button to the right of the Saved filename format area to bring up a guide of all the fields you can insert in here.

TIP: Just double click the field in that popup window and it will insert the field at the current cursor location into the text area.

A few things to also keep in mind:

  • Always include {ID} in the Saved filename format. Excluding the {ID} will result in inconsistent downloads. This is because the program uses multiple threads to download emails simultaneously. If two filenames happen to clash on the filename, you may notice inconsistent behavior.
  • When you are using a shared folder as the Save folder, it MUST be a UNC path (do not use a mapped network drive as these will not work with the service installation).

READ this blog post on how to set the rules up to save different emails or attachments to different folders.

Downloading entire emails (w/o attachments)

Save filename and format

Also, to download the body or download entire emails (even those without attachments), click the ‘Save as .eml‘ checkbox.

Also make sure the ‘Save inline content’ checkbox in the Global filters tab is checked (or if you are using individual account settings, pick the account in the Account dropdown and check the Save inline content in the Search tab).

This will save the entire email (including attachments) as .eml file. If you want just the .eml file, specific a filter in the rule (like we did for Subject) to include just .eml.

If you want to run actions but not save the .eml, just add a delete file action after saving the file.

Download actions

Next we can add download actions that are run after the attachment is saved.

Lets suppose that the document attached in the email was .docx and we want to covert it to a .pdf. This is possible by choosing Add action in the Actions after save section and then clicking on Document conversion menu item as shown below.

Then we have added the document conversion action and you can add a new conversion by clicking on Add conversion button. Once complete, you will see something like the below indicating that Any doc is now converted to a pdf.

doc conversion action added

Save the rule

Now click on the Save button. That’s it, you have created your first rule.

If you want this rule to only apply to a certain email account and not all accounts, you can specify a filter as we did with the Subject instead choose Account filter as explained below.

In the filters section of the Rule window, click Add -> Filters -> Account and choose the account from the dropdown. Then click Save.

Do this for each rule that applies to that account.

Create unlimited number of rules and actions

Similarly, you can create any number of email rules with different save locations and different actions.

This provides rich automation capabilities with ease and enables you to automate backend email to perform more complex tasks.

Multiple rules: Points to remember

email processing

TIP: Keep these in mind when defining multiple rules…

  • All rules are run for every attachment in the email and/or the .eml (if Save as .eml was checked).
  • All rules are run for any account that is selected in the Account dropdown (in the main program window). You can restrict a rule to a specific account by adding an Account filter and selecting the specific account in the dropdown inside the rule configuration.
  • Ordering: Rules are run from the top to down in ORDER they are defined. Drag and drop rules to move them order to affect the ordering.
  • If a Rule matches a given attachment or .eml, then no other rules below it are run for that attachment or .eml.
  • Emails without attachments can run actions as well, you will need to check the Save inline content checkbox in the Global filters tab AND check the Save as .eml checkbox inside the rule (next to the Save folder).
  • Actions in the rule are only run when there is a rules match and a file is saved. If you don’t want to save the file but want to run actions, just add a delete file action after saving the file in the rule.
  • PRO-Server: When making any config change, always uninstall and then re-install the service from the service tab.

Summary

This quick post shows how you can add many email accounts and many filters to handle simple automation tasks.

To see the full list of features or download actions the program supports check our PRO page and browse through features described there.

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.