Overview: How to Retrieve Email Messages & Attachments
In this tutorial, we'll show you how to enable your local server to automatically retrieve email messages and attachments from a remote mail server.
What we're trying to achieve
Why you might find this useful
As a business, there are a number of reasons why you would want to know how to retrieve email messages and attachments. Perhaps you'd want to:
- Consolidate all your communications and files in one place;
- Perform backups for upgrade, migration, disaster recovery or compliance purposes;
- Gather the messages for parsing and additional processing; or
- Forward the items to another server (e.g. one owned by a trading partner).
While there are several ways of doing this, the best option for businesses is to use a managed file transfer server. Some of the reasons include the following:
- You can automate the process. This can be useful if you want to perform the download on a pre-defined schedule (e.g. every Friday, at 9PM) or in response to a particular event (e.g. after you receive a set of files from a trading partner)
- You don't have to write scripts to implement automation. For example, if you're using JSCAPE MFT Server, you can use triggers. These are GUI-based automation-enabling tools that expedite and simplify the process of implementing automation.
- You can automatically encrypt files as soon as they're downloaded and keep them encrypted while stored. This capability is crucial for organizations where cyber security and compliance is a must.
- You can forward the items to another server using other file transfer protocols like FTP, SFTP, FTPS, etc. You'll find this useful if you need to forward copies of the messages to a business unit or trading partner whose server doesn't support POP or IMAP but supports certain file transfer protocols.
- The entire process will be conducted in a highly secure environment. An advanced managed file transfer server like JSCAPE MFT Server is strongly equipped with security features like data-in-motion and data-at-rest encryption, DLP, password compliance, support for automated virus scans, data isolation, strong authentication, and many others.
Think this is something you can use? Here's the way to do it on JSCAPE MFT Server.
1. Create a trigger
As mentioned earlier, Triggers are a suite of GUI-based tools on JSCAPE MFT Server that enable automation. You can read more about triggers in the documentation or in our large collection of trigger-related blog posts. I suggest you forego following those links for now and just read through the tutorial just to see how easy it is to automate the task of grabbing email messages and attachments.
To create a trigger, go to the Triggers node and Add a trigger.
2. Select an event
A typical trigger listens to a specific event and then responds to it. So the first thing you would do would be to select an appropriate event.
For example, if you want to fire up this email message retrieval process on a pre-defined schedule, then you would choose the Current Time event type.
We've already written a blog post that discusses at length the process of creating scheduled file transfers, so I suggest you read that first. Read "Benefits of a Scheduled File Transfer and How To Set One Up".
In the sample screenshot below, the event type shown is the "Directory Monitor File Added", an event type that's raised whenever files are added to a particular directory.
Once you've chosen the event you want, click the Next button.
3. Specify a trigger condition
A production-deployed managed file transfer server will normally have multiple triggers that listen to the same event type. If you want a trigger to respond to a particular event only when certain conditions are met, then you need to add trigger conditions. For example, if you want your scheduled message-retrieving trigger to fire only on a specific time (say 8:30 pm) and day of the week (say Friday), then you can write a trigger condition likeso:
Click the Next button to proceed.
3. Add and configure the Check Mail trigger action
We now proceed to the centerpiece of this tutorial - the trigger action that retrieves the email messages and attachments. That trigger action is known as the Check Mail trigger action. Click the Add button and select the Check Email trigger action. Click OK to proceed.
With that, you should then be asked to specify the trigger action's parameters. The basic parameters are the following:
Hostname - This is the email server hostname or IP address (e.g. imap.gmail.com)
Port - The email server port (usually 143 or 993 for IMAP and 110 or 995 for POP)
Connection type - The choices are PLAIN, SSL, or START-TLS
Username - The email account username
Password - The email account's corresponding password
Message Directory - The directory in which to store the retrieved email messages
Attachments Directory - The directory in which to store the retrieved email attachments
As soon as you're done entering parameters, click all OK buttons until you're back at the main screen
That's it. That's all you need to do to automatically retrieve email messages and attachments from a remote mail server and then store the retrieved items locally.
Want to try this yourself? Download a free, fully-functional evaluation edition of JSCAPE MFT Server now.