Nesting email rules and actions

Latest builds of v3.2 provides you 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.

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.


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.


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.

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.


Automate emails and integrate applications

This post explores how to extract data from emails, automate backend processes and hence reduce repetitive tasks. It also provides an overview of how to integrate LOB applications using some of the solutions provided on this site.

Automate email with attachments

What options do you have when it comes to automating emails?

Mail Attachment Downloader PRO versions offer a cost-effective solution to automating emails within your enterprise running as a service on a server or in the cloud through Windows Azure (PRO Server version required).

The way this is achieved is using rules for emails. You can setup many rules for the software based on your needs via the UI. These rules can be run for a single email account or across many accounts simultaneously.

Scheduled processing

Mail Attachment Downloader PRO Server lets you process incoming email on a scheduled frequency in the background 24×7 unattended as a Windows service.

It can recover from system restarts automatically, runs in the background even when no user is logged on and can also data center failure if a hot-standby is used to do so.

It can also be run in the cloud using Windows Azure if needed.

Ordering of rules

The rules defined in the program are run top-down for each email and attachment. The first matching rule is used to download any emails or attachments within the email. If no rules are defined, then all emails will be downloaded.

Phases of rule processing

The software breaks down processing emails into the following phases for each rule as shown.

email processing


  • Search and Filter phase: For each rule, you can specify which emails or attachments need to be processed by including search filters using the Add button -> Filters
  • Save files: Specify the format and location of where you want any files to be processed to be saved. This could be a temporary location if you do not want this data permanently stored. This could also include a file share (use UNC path).
  • Process email and files: This last phase is used to run the automatic processing and includes many different actions as shown below. These can include nested actions for example, unzip a file, decrypt a PDF, extract data and save the information to a database.

email actions

Multiple email accounts and filters

Once these are setup for a rule, you can enter many such rules. If you have multiple email accounts to process, you can restrict a rule to apply to only one email account if needed by using an account filter (Add -> Filters -> Account email in the rule).

SDK or API for email integration and processing

We now offer an SDK or plugin API to integrate with your backend systems in a more seamless manner. Contact us for more.

Common uses

  • 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

Conclusion: Automate emails, process and integrate applications

We have provided a brief overview of how to automate data from emails within your enterprise using an on-prem service or a cloud-based self-hosted service using Windows Azure using Mail Attachment Downloader PRO.

If you have a specific use-case that is not covered let us know or if you need help integrating your backend systems we may be able to offer consultation services to do so.

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.

Bulk download emails, attachments and save

Mail Attachment Downloader lets you bulk download attachments,  bulk download emails and archive or save them as eml, pdf, docx, tiff and more.

Saving emails and email attachments has never been easier. We offer a FREE version available on our website and also a PRO version that has additional capabilities that the FREE version does not.

Mail Attachment Downloader is NOT dependent on any installed email client such as Outlook and can work independently on a server if need be.

The FREE version lets you bulk download email attachments. The PRO version lets you bulk download both email attachments and emails (in .eml format or .txt or .html formats or .pdf or .docx or a .tiff multipage image).

If you want to save emails and attachments into a SINGLE PDF, you can do so as described in this blog post.

Bulk download emails as .eml and save

We will explore how to set this up using the  Mail Attachment Downloader PRO version.

  • Create a new rule filter by going to the Global Filters tab and clicking on Add a new filter.
  • Type in the rule name for the new filter.
  • In the Save area, check the Save as .eml checkbox as shown

    Bulk download emails

This will bulk download emails as .eml files to the save folder.

In addition to the above, you can create many rules to only save certain .eml files like those that match a certain FROM email or a certain SUBJECT each out to different folders by creating a rule per save location.

Save emails and email attachments as PDF, DOCX or TIFF

If you want to have this .eml saved to a different format like PDF or DOCX or a multipage TIFF (the PRO Server supports over 50+ file formats), do the following:

  • In the Actions after save section, click on Add action -> Document conversion
  • Select the Document conversion entry if not already selected and click the Add conversion button

    convert to pdf
    archive emails
  • Select the From type as Any doc and the To type as PDF or TIFF or DOCX.

That’s it!

Now you have emails being saved to PDF or any other format as desired.

If you want only the .eml to be saved without the attachments, you can add a Filename filter and specify ‘.eml’ in the filter text box. This will only download the .eml’s without downloading the attachments separately.

If you want to save emails and attachments into a SINGLE PDF, you can do so as described in this blog post.

Automate bulk downloads

With the PRO Server version you can run the above setup 24×7 as a Windows Service and not have to worry about opening up the program every time you need to bulk download emails.

If you have any questions, please feel free to contact us.

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.

Nested email actions: unzip, convert or decrypt PDF and run a script

Setup email actions such as unzipping an email attachment, converting the email attachment to pdf and running a script easily with Mail Attachment Downloader PRO Server.

This post will show you how to setup a rule to Unzip a file, then convert the unzipped .docx or decrypt a .pdf and then run a script.

In the Actions section, do the following:

  1. Select ‘After saving attachment‘ from the tree view on the left. Note that even though this says ‘After saving attachment‘, you can run actions on the body of the email as well which will be downloaded as an attachment when you click on the ‘Save email text’ checkbox.
  2. Click on Add button -> After saving attachment -> Unzip files and select any options as shown below. You can enter which specific files you want to unzip in the box which can also include wildcards or regular expressions. If you have multiple, separate each file or wildcard by a new line.automate email actions: unzip_files
  3. Select Unzip files from the tree view on the left. This is necessary to create a sub action under unzip files so every unzipped file runs the remaining action. You can also specify which files to unzip in the previous step. Now click on Add -> After saving attachment ->  Document conversion. Fill in the conversion details by clicking on the Add Conversion button. Note: You can also choose to decrypt the unzipped file if the source file was a PDF by providing the password to decrypt the file.automate email actions: madpro3_convert
  4. Select Document conversion from the tree view on the left. Then Add -> After saving attachment -> Run command line. Enter details to run a command line. In this case we are running a .bat file with the filename of the converted file – {FILENAMEEXT} in the screenshot below now represents the converted filename now from the previous step and not the original saved filename. automate email actions: madpro3_pda_runbat

That’s it.

If you have questions or need additional actions, please contact us and we can help assess feasibility.


PDF to DOCX conversion and more

Convert PDF to DOCX easily with Mail Attachment Downloader PRO Server

When you run the server version you can run the program as a Windows Service that runs 24×7 unattended. Then just email the PDF as an attachment to your email and have Mail Attachment Downloader PRO Server pick it up and automatically download/convert the file and save it in the way you want it.

  1. Open Global filters tab and either click the Add new filter or Edit selected filter button
  2. If you are creating a new rule, just enter a meaningful filter name.
  3. Under Actions, click Add action and choose  Document conversion. This will add a new action in the list to the left. Click on the Document conversion list item under After saving file. You will see the conversions that are configured on the right side. convert to pdf
  4. Click on the Add conversion button.
  5. In the From Type select Any doc and the To Type specify docx. Click OK.PDF to DOCX
  6. Save the rule and that’s it!

Any email that you receive that has a PDF attachment (including some other related formats like LaTeX etc.) will be converted to DOCX.

If you receive encrypted PDF files, you can provide the decryption password in the PDF Decryption Password text box as can be seen in the screenshot in Step-5. You will need to do this before you can convert it to DOCX.

With the Mail Attachment Downloader PRO Server version, you can use it to convert emails (.eml or .msg or .txt or .html) and email attachments (text, html, word, excel, powerpoint and more) to over 50+ formats (bmp, csv, dif, doc, docm, docx, dot, dotm, dotx, emf, epub, excel, flatopc, flatopcmacroenabled, flatopctemplate, flatopctemplatemacroenabled, html, htmlfixed, jpeg, mhtml, mobixml, odp, ods, odt, openxps, ott, pdf, pdfnotes, png, potm, potx, pps, ppsm, ppsx, ppt, pptm, pptx, ps, rtf, spreadsheetml, svg, swf, tabdelimited, tex, text, tiff, tiffnotes, wordml, xamlfixed, xamlflow, xamlflowpack, xlam, xlsb, xlsm, xlsx, xltm, xltx, xml, xps)!

You can use this to convert from the following popular formats:

  • DOCX to PDF, PNG, JPEG, HTML and more
  • PDF to DOCX, PNG, JPEG, HTML and more
  • CSV, XLSX to PDF, PNG, JPEG, HTML and more
  • PPTX to PDF, PNG, JPEG, HTML and more
  • EML to PDF, DOCX, PNG, JPEG, HTML and more
  • JPEG, BMP, TIFF, images to PDF, DOCX, HTML and more

If you have any questions or suggestions, please contact support.

Email Processing Tools and Solutions