Processing emails or attachments to folders easily with Mail Attachment Downloader PRO Client and PRO Server. In this post, we will explore tips that you’ll need to learn how to use the program effectively.
In addition to this post, you can always find help additional here:
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.
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).
Free to PRO: Learn to use global filter rules
Use the Global filters tab available in the PRO Server product — gives you access to more customizability of how to process each every email or attachment. This tab replaces most of the functionality in the folder/files, search and filters tabs.
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.
The detailed blog post below will walk you through how to set this up.
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.
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.
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.
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, oneper 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.
Rules overview
The Global filters tab (only available in the PRO versions) 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.
Important tips to rules:
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.
Running rules: 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.
Restrict a rule to run only for one account: If you want a rule in the Global filter to only run for a specific 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.
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.
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.
Tips on naming rules
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.
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 and then 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’.
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.
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}.
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.
Create multiple rules for different folders
Create multiple rules to match different emails and save them to different folders.
Perform actions after save
You can also then perform various advanced actions for each rule after the file is saved.
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:
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.
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.
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.
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.).
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.
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.
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.).
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).
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.
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)
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.
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
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 downin 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 fulllist 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:
When using invoice processing software, there are cases where you want to download emails and email attachments to a folder in a specific format so the invoice processing software can pick them up.
There are two paths to solving this today. One approach make use of solutions that require you to have an email client installed and offer limited functionality. Then there are tools that are more complex taking months to configure, test and deploy.
Mail Attachment Downloader PRO Server offers a sweet spot by offering flexible tooling for this purpose whilst making it easy to customize it for your specific needs. As you read on, we’ll show how this product can do more than just saving attachments to a folder or a share if your business needs it.
Let’s consider the case where you receive many invoices via email with (or without) attachments that then need to be saved for later consumption by invoice processing software.
Once the data is saved in a folder or share, you can either have the PRO Server save the invoice details into specific database fields OR run a custom script to hand it off to your line-of-business application OR have the invoice processing software monitor the folder and pick up the invoices and process them through the workflow. Also, the share could serve as a secondary backup for your invoices you’ve received.
You can also configure the program to save not only the invoices, but the email textor body as well very easily by just clicking on the ‘Save email text’ or ‘Save as .eml’ checkbox in the Rule filter screen (see below screenshots). This could come in handy if the invoice is in the body of the email itself (no attachment in the email, that is).
Also, let’s say that the Subject of that email is something like “Your Invoice #853290 is ready“. And we want to store this attachment under the folder of the Invoice # and use the filename that was sent prefixed by who it was From (from email address).
We will use the Mail Attachment Downloader PRO Server version prior to submitting the data to our invoice processing software that enables a LOT MORE flexibility in how you want the attachment named via a template mechanism as will be shown below.
Create a Rule Filter
First, since the PRO Server version lets you create many filters, let’s create one filter for Invoices.
Click on the Global Filters tab and the Add new filter button as shown below.
Enter the Rule filter name as something meaningful, we’ve called it ‘Invoices‘ as shown below.
Filter by SUBJECT
Second, since we want to only look at emails with a subject that contains the Invoice #, we need to add a filter to look for those emails. Click on the Add dropdown arrow -> Filters -> Header: Subject as shown below.
Since we know the format of the subject at-least has “Invoice #” we are going to first include that.
Extract the Invoice # from the SUBJECT
Third, since we want to extract the Invoice # for further invoice processing.
With this post we will explore extracting data for invoices from the email using regular expressions. In a future post, we can walk you through how to use the Extraction Wizard if needed.
Since the Invoice # is in the Subject of the email, we will add a new extraction to the new rule we created as follows. Click on the Add dropdown -> Extractions -> Regex Extraction.
Rename the Extraction field to something meaningful like “{INVOICE_NUMBER}” as shown below and include a regular expression to extract text.
In the Pattern field enter ^.*Invoice #(\d+)([a-z| ]*)$. If you notice symbols like ^, $ and \d and * are indicators to what to look for in the Subject. ^ implies start of the line and $ is the end of the line. The .* means include any number of characters followed by Invoice #. Since what follows Invoice # is a number we include (\d+). This becomes our first extraction field (which we will use as the Replace text). Following that could include any number of characters or spaces ([a-z]| ]*) followed by the end of the line $.
In the Replace textbox, specify $1 which is the first match between the parentheses () we have specified in the Pattern, in this case (\d+).
Feel free to contact support if you have a different pattern to look for and we can help you craft this as needed. Refer to the Microsoft’s regular expression reference here for more.
Then you can Test the result out as shown above, if you notice TEST SUCCESS includes our extracted Invoice #. This will save with the invoice number for invoice processing into the field name.
NOTE: As mentioned before, if you are not well versed with regular expressions, we recommend using the Extraction Wizard instead.
And lastly, we will enter the save filename format as shown below:
The INVOICE_NUMBER field is the invoice number we extracted from the Subject. After which we include a \ to indicate this is a folder and then EMAIL_FROM which is the email address followed by the FILENAME, the ID of the email and EXT for the extension.
Lastly, click the Save button which will save the rule out and then you are ready to try downloading a few attachments to see if the extractions worked as intended.
If you were wondering what other information you could include in the Save filename format field, click on the little ? button which will open up a help option for this as shown below. As you can see, there are very many options to choose from giving complete flexibility to you.
If you find something that is missing in the features above, let us know.
Run download actions after save
You can then use any of the extracted fields along with any email specific fields (such as {FROM}, {TO} etc.) in the numerous download actions that are supported. This includes saving the data out to a database, saving to a .csv metadata file and many more.
Once the data is saved in these folders, you can trigger the invoice processing software via a script (if you have the PRO Server, you can run a script after saving the file to a folder) or folder monitoring as needed.
Once this is complete, if you have the PRO Server version you can now install the above as a Windows Service and not have to worry about having to log in to the box to process these attachments.
The Mail Attachment Downloader Free version also enables you to do some of the above but has the following limited features:
For personal use only
ID of the email in the filename. We highly recommend keeping the ID in the filename as if this is removed it may result in duplicate filenames that may result in overwriting of the filename.
Fixed formatting of filename to include email headers are supported in a specific non-flexible format in the FREE version. The PRO versions include much more flexibility in how filenames are formatted as was shown above.
From like ‘From (Bran E. <bran@gearmage.com>)’
To like‘To (Atul <atul@gearmage.com>)’
Subject like ‘Subject (Our invoice)’
Date like ‘Date(Wed, 24 Feb 2016 21_44_15 -0800)’
The ability to create a folder based who the email is from.
The ability to create a folder for every mailbox folder eg. “Inbox”.
While this is great, it does not allow us to be more prescriptive about how we want to store the attachments. So if you need more flexibility you should get the PRO or the PRO Server versions.
Further reading
Some interesting how-to links and posts for further exploration:
Create a new filter or edit an existing one in the Global Rule tab
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.
Add a new document conversion by clicking the ‘Add conversion‘ button.
Pick the source format (From Type) and the destination format (To Type). If you are using the PRO Server, then you can pick any format in the To. Otherwise, you will be limited to just PDF.
Click OK
That’s it!
Now each document attachment (doc, docx, txt, html, rtf, eml etc.) will be converted to PDF or TIFF or any To Type you selected above.
If you want to also save the email body in addition to the attachments as PDF or TIFF, check the Save as .eml checkbox in the rule and the document conversion action (from Doc -> PDF or TIFF) will also convert the .eml file to PDF or TIFF. The .eml extension is considered a document for conversion purposes.
If you want to convert other types such as cells (xlsx etc.), slides (ppt etc.) or images (jpgs etc), you can repeat Step-3 to add the different From’s if you would like.
This will save each attachment as a separate PDF or TIFF files. Further below we show how you can saveemails and attachments as a single PDF. You can also save emails and attachments to a multi-page TIFF if required by following the same instructions except select tiff as the To type.
You may also choose to encrypt the PDF file by checking the ‘Encrypt PDF‘ checkbox if needed.
Save emails and attachments to a single PDF
To save emails and attachments as a single PDF, you will need the PRO Server version and the following setup:
Make sure Save as .eml is checked, this will save the email body.
Ensure Document Conversion action is added and includes conversions from various types to PDF as shown below. Check the delete source files after conversion checkbox.
The above will save the body and attachments all separately as PDF files. You can skip the next step if that’s all you want to do (save as separate files).
To merge them into a single PDF: Right click on Document Conversion and then add Merge PDF files action. Check the delete all source PDFs checkbox.
Merge PDFs
Now emails along with attachments will end up being a single PDF where the email is the first few pages and subsequent pages are the attachments rendered as PDFs.
Over 50+ Formats
If you get 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, multi-page TIFF, PNG, JPEG, HTML and more
PDF to DOCX, multi-page TIFF, PNG, JPEG, HTML and more
CSV, XLSX to PDF, multi-page TIFF, PNG, JPEG, HTML and more
PPTX to PDF, multi-page TIFF, PNG, JPEG, HTML and more
EML to PDF, multi-page TIFF, DOCX, PNG, JPEG, HTML and more
JPEG, BMP, TIFF, images to PDF, DOCX, HTML and more
Further reading
Some interesting how-to links and posts for further exploration:
Save emails and attachments to a database (SQL Server)
In this post, we will explore saving emails and attachments to a database server like SQL Server by setting up an ODBC data source and using a post download Action to save contents of the email and/or attachments to a database.
The program supports and works with any compatible ODBC data source such as MySQL, Oracle, PostgreSQL and more. This post only explores setting up to save the data in SQL Server but also has information on how to tweak it for other database types.
Each rule can be setup to save emails to databases using either generated SQL (to one or more tables) or a custom SQL.
You do not need to know SQL to save emails or attachments to a database. And if you do know SQL, it offers the flexibility and customizability to modify the SQL statements to suit your needs.
You can even include extracted data from emails or attachments using custom variables in your SQL statement and save them to a database!
Each rule has several phases — first, search and filter through emails or attachments, then extract data from emails or attachments, saving email bodies or attachments to a customizable file or folder format if needed and lastly post-process the emails or attachments by saving them to a database of your choice.
Used by many Fortune 500 companies today to save emails and attachments to databases. Runs 24×7 in the cloud or on-premise as a Windows Service.
You get a versatile tool that provides flexibility in storing emails to databases in just the way you want to.
Step-by-step tutorial — emails to databases
Setting up a datasource
Let’s start off by adding a new data source — click on the Database tab -> Add ODBC source button
Provide a name for the source first. Then pick either the 32-bit ODBC driver or 62-bit ODBC driver (depending on whether you installed the 32-bit or 64-bit version of Mail Attachment Downloader PRO Client or PRO Server).In our case, the driver “SQL Server” from the drop down indicates the 32-bit driver. Then enter the Connection string that specifies how to connect to the server:Server=<computer name>\<SQL Server name>;Database=<DB name>;Trusted_Connection=yes;
An example of these filled in is shown below: Server=TESTPC\GEARMAGE;Database=TestDB;Trusted_Connection=yes;
Click Test Connection button to make sure this succeeds. Then click OK.
At this point a data source has been setup.
Rule configuration to save the email to a database
Then create a new rule or edit an existing rule from the Global filters tab.
Under Actions after save click Add action and then choose Save to database. This will add an action under After saving file in the list to the left. NOTE: The screenshot below shows other actions as well, if you have other actions you can chain or nest the save to database action after those actions have taken place as shown below.
Pick the Source as the one you provided in Step-2.
Specify a new table name (or an existing one) and then click “Create Table” if this is a new table and follow the prompts. At this point a new table schema would be created and the SQL would be automatically filled in based on the questions you answered.
Click “Test SQL” to test connectivity and table row creation, this will add a new row to the table to make sure everything is setup correctly.
Click the Save button to save the new rule with the Save to DB action.
Now you can click the Connect And Download button to test out the ability to save to DB.
That’s it!
You have setup the program to automatically save emails and attachments to a database.
IMPORTANT CONSIDERATIONS
Make sure you select either the 32-bit ODBC driver or the 64-bit ODBC driver in the dropdown depending on which installation of Mail Attachment Downloader PRO Client or PRO Server you installed (license email has links to both versions of the install). This is supported in all Windows versions including Windows 10. In some cases default installations may only install the 64-bit driver and you may need to manually download and install the 32-bit ODBC driver for your database. Please consult the database documentation and Google on how to do this.
Your specific connection string can vary depending on the type of database (for example, Oracle has different connection strings than MySQL). A useful site to help you with the ODBC connection string is https://www.connectionstrings.com. Make sure you only choose the ODBC connection string in the sitefor yourdatabase type (like Oracle). You may need to play around with the different strings and test connections to find the one that works. If your connection string includes a Driver name, make sure it matches exactly (space for space) the one you have picked in the dropdown.
Depending on the type of DB you use, the automatic creation of table/sql may fail. In that case, you might have to provision the schema for the table in the DB manually and then specify the SQL to insert records into the table in the program.
You can save the attachment content using the following variable in your SQL
{RAW_CONTENT}
Further reading
Some interesting how-to links and posts for further exploration:
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.
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.
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.
Did you know that newer builds of PRO Server and PRO Client have new functionality that you may not have? Upgrade now to get new functionality.
If you are on earlier builds, you may also see new actions or filters that might come in handy….
Filters enable you to specify when you want this rule to run.
Actions enable you to perform functions that take place after the filter matches.
Explore and familiarize yourself with new functionality in the following areas:
— Global rules: Learn how to use global filters to route emails or attachments and take actions. For example, you can now copy/paste filters or actions inside a global rule. Or copy/paste a filter or an action from one rule to another.
— Negative rules and nesting: If no attachment was downloaded, did you want to send an email? With negative rules this is possible.
— Better troubleshooting: Want to know why a rule did not match an email or attachment? Enable rule tracing today and find out why.
— Better extractions: Extractions now support .NET regular expressions in Search and Followed By fields for better flexibility.
Upgrade now to get new functionality such as the ones mentioned above and more.
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.
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 childGlobal 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.
Nest actions inside a Global Rule or a Shared Action
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:
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.
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).
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 next to the Rule Tracing checkbox.
This should bring up a popup window something to the effect of the below.
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.
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.
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.
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.
PRO Server offers flexible extraction constructs to extract data or fields from both emails AND/OR attachments.
This post will explore how you can setup the PRO Server to extract data using the extraction wizard (Option-1) or using regular expressions (Option-2).
Use the Global Filters tab to extract data
First off, to extract data you MUST use the Global Filters tab. This allows you to create one or more rule filters that will then be used for extraction.
Each rule is run for EVERY attachment (any type, converted to text before extraction occurs) or email body (saved as .eml or .txt/.html).
In a rule, you can specify what to look for in the email (like matching From, To, Subject etc.) and then parameters to extract one or more data into fields as will be explained below.
FIELDS: Extract data into fields {..}
Fields are what you as a user can create in the Rule that then can be used in various actions.
Extracting data in the PRO Server is performed by first specifying a field name and then providing various parameters in the Rule configuration such as:
WHAT to extract by specifying what comes before or after the piece of data you want to extract
HOW to extract it by specifying whether to remove whitespaces or convert it into a number etc. as will be shown
Specifying a unique FIELD NAME (between {}) where the extracted data will be “stored”. For example: {ORDER_ID}.
FIRST: Specify the matching filters
The very FIRST STEP in extraction is to create or edit a rule in the Global Filters tab and then specify the Filters that helps narrow down the type of email we want to extract data from.
In there you MUST specify the specific email filters to select the kinds of emails you are looking to extract data out of.
As shown above we’ve used a matching Subject and a From that matches a certain address.
SECOND: Two ways to extract data in a rule…
There are two ways to extract data inside of a rule as will be explained below.
When you create or edit a rule in the Global Filters tab, you can start out by specifying Filters and then have two ways to perform extraction as shown in the below screenshot.
Filter extraction with wizard (recommended)
Filter extraction with regular expression
We will explore each option in this post below.
Option-1: Filter extraction with wizard
Create a new extraction by selecting Add -> Extractions -> Field extractionwith wizard
as was shown earlier.
You now have the option to name your field. A random name has been automatically selected, feel free to change this to something more meaningful.
For the purposes of this tutorial we will use {ORDER_ID}. The field name MUST be within braces {}. Then select the Source from the dropdown option as to where you want to extract data from.
NOTE: This dropdown does not include the attachment itself, we will cover this later below.
We will choose the EMAIL_SUBJECT as the source for this tutorial.
Click on the Extraction wizard button and follow these steps:
Copy Sample Text: Once the dialog opens, lets start off by copying some text that may be a sample “Subject” of the email into the Test data area.
Search tab: Specify here the text that may PRECEDE the actual data we want to extract. In our test data, we have Invoice # as a good prefix. So let’s use that.
This allows you to specify more than one search term, for example, specifying (Invoices|Receipts) in this text including parentheses will search for Invoices or Receipts as the text to search until before extracting data after it.
Extract tab: Since what follows after the invoice is a ‘-‘ hyphen, we will choose the Until any of these option and then specify the hyphen as the character to stop extracting data as shown below. You can also see that the test data now highlights the invoice number.
Transform tab: From our previous step you can see that we have an extra space towards the end of the invoice number. This tab lets you transform the extracted data in many ways. Since we just want to remove the space, we will check the Remove leading and trailing spaces option. Feel free to experiment with the various options present here. You can also convert the extracted data from a String to an Integer or Decimal in the Convert to type dropdown.
Validate tab: In here you can specify any validations. Since we absolutely want an invoice number to be present before we take further actions like saving the email or attachments in the rule, we will choose the No blank or empty extractions option.
On Failure tab: When an extraction fails validation (based on what we specified in the validation tab), we want to skip this rule and proceed further.
Click Save
Now we have completely set the parameters on how we want to extract the data.
Feel free to change the Test data and click the Run Test button to run tests. The Status below will show what was extracted. As shown above it says OK: 7265537 and that means 7265537 was what was extracted based on the Test data which is what we want.
Extract data from email attachments
Extracting data from email attachments is very similar to what has been described above with Option-1, except instead of choosing Add -> Extractions -> Field extractionwith wizard
you will be creating the field extraction in the Actions section as shown below:
Make sure that the ORDER at which the extraction occurs is correct. Any actions that are run BELOW the extraction will have the extracted field.
Since we want to extract the Invoice # for further invoice processing.
With this post we will explore extracting data for invoices from the email using regular expressions. In a future post, we can walk you through how to use the Extraction Wizard if needed.
Since the Invoice # is in the Subject of the email, we will add a new extraction to the new rule we created as follows. Click on the Add dropdown -> Extractions -> Field extraction with regular expressions option as shown below.
Rename the Extraction field to something meaningful like “{INVOICE_NUMBER}” as shown below and include a regular expression to extract text.
In the Pattern field enter ^.*Invoice #(\d+)([a-z| ]*)$. If you notice symbols like ^, $ and \d and * are indicators to what to look for in the Subject. ^ implies start of the line and $ is the end of the line. The .* means include any number of characters followed by Invoice #. Since what follows Invoice # is a number we include (\d+). This becomes our first extraction field (which we will use as the Replace text). Following that could include any number of characters or spaces ([a-z]| ]*) followed by the end of the line $.
In the Replace textbox, specify $1 which is the first match between the parentheses () we have specified in the Pattern, in this case (\d+).
Feel free to contact support if you have a different pattern to look for and we can help you craft this as needed. Refer to the Microsoft’s regular expression reference here for more.
Then you can Test the result out as shown above, if you notice TEST SUCCESS includes our extracted Invoice #. This will save with the invoice number for invoice processing into the field name.
Finally: Uses of the extracted data
Now you can use the {ORDER_ID} or {INVOICE_NUMBER} fields we extracted in many places inside THIS rule such as:
In the Save filename format as a Folder or part of the filename. If you want it as a folder just separate with a ‘\’ character as shown below. Click the little (i) button next to the Save filename format for a complete list of fields that can be inserted here.
In the Send email action — in the Subject/To/CC/BCC or even the BODY you can specify the field like {ORDER_ID} and it will be replaced.
In the Copy or rename file action in the filename format fields
In the Move or copy email action (note: in this case the mailbox folder MUST already exist, the program will not auto-create it)
In the Document conversion action in the filename/format where the converted document should be saved
In the Save to database Or Extract csv and save to DBaction inside the SQL query.
In the Run script or Run command actions as arguments
and many more.
Conclusion: Extract data
We hope you found this post useful in extracting data from emails or attachments.
We highly recommend that you read the below TIPS and TRICKS post for a guide to other features in the product where you can use extracted data.
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.
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.
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:
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.
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.
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.
Pick the sheet from the Choose sheet dropdown you want to load data from.
Click the Load column names from sample file button. This will load the column names as cell id’s (eg. A1, B1 etc.).
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.
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.
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.
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})
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.
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: