Automatically extract and archive email attachments to a folder

Image

Question

"We would like to extract all email attachments from incoming emails and archive them to a local or network folder."

Configuration

  1. Create a new channel with the name "Archive email attachments automatically"
  2. Set the schedule to [Periodic scheduling] and set a time interval of 10 minutes.

Note: commercial email providers like Gmail, Hotmail, Outlook tend to use a restriction and only allow a polling interval of 10 minutes to prevent attacks!

  1. For [Input] use [Email] as input type.
  2. Configure the email connection. In our case we use IMAP and complete the connection info (server, port 993. enable SSL/TLS, username and password). Use the connection settings from your system.
    Your configuration might look similar to this one:

    Image

  3. Navigate to the [Options] tab and select the folder you want to monitor by clicking [Browse].
    In our case we monitor the INBOX.
  4. For the option [Data to return:] select Only the attachment(s).
  5. Optionally you can select an [Attachment filter]. This allows you to only process certain types of attachments.
    We only want to process emails that have PDF documents attached. By using a regular expression (regex) we filter out files with a pdf extension: (?i).*[.]pdf$
    Image

  6. Skip the [Input Filter] and also skip the [Conversion] tab.
  7. For the [Output] select Local/Network in case you want to archive the documents to a local or network folder.
  8. For [Post-Action] we will configure two actions on success:
  1. First mark the email as read.
    (File Processor processes unread emails, so we have to mark them as read, otherwise they will be processed over-and-over again!)
    Image
  2. Second, delete the email:
    Image

It is a good practice to first mark the email as read and afterwards delete it. Some email servers do not delete emails when they are not first being marked as read.

Extra

How can we process only emails with PDF attachments, coming from the email domain @ricoh.com ?

This can be done by using an Input Filter.

  1. Go to [Input Filter].
  2. Click the green [Add] button.
  3. Select the option Property for [Filter type:] and click [Add]:
    Image
  4. We want to match the From-email address with a regular expression .*[@]ricoh.com$
    Image

Note: some email servers will not give you the From-email address but will also prefix the name,
for example (John Peeters) John@ricoh.com or "John Peeters" <john@ricoh.com>
For this you will need to test and modify your regular expression.

Summary

You should have learned how to process email attachments and archive the attachments. By using the attachments filter from the email you can filter out attachments that end with a specific file extension, or that contain specific words or numbers. For example, this would allow you to only archive PDF attachments from emails.

The Input Filter works on the complete email, not on the attachments (as an attachment is contained inside an email). Therefor the Input Filter is very suited to filter out specific email accounts. With a regular expression it is easy to filter out only emails coming from specific accounts or domains.

In this example we used IMAP, but Exchange or other email providers could also be used.