How to Set Up Automated Emails for Past Downloads | JSCAPE

Did you know you can use our MFT Server to send an email after your scheduled automatic download is done? Learn how to set up automated emails online!
  1. Blog

automated-file-transfer-surfer-path-1

Overview

Your scheduled automatic download should be finished by now. But how would you know how it went without physically or remotely logging into your server? Had you used JSCAPE MFT Server, you could have configured it to email you an update. In this post, we'll show you how to set up JSCAPE MFT Server to email you a message along with a file attachment with details about your latest file transfer.

What we're trying to do

email_list_of_downloaded_files

You can consider this a continuation of a previous post where we enabled JSCAPE MFT Server to generate a list of freshly downloaded files. That list was stored in a file. We'll now use that file to signal the server when a download has been made. This will entail creating a directory monitor that would detect when that file has changed. Assuming no one else edits that file, a change will only occur whenever a list has been generated unto it, which in turn can only happen as a result of that scheduled download.

1. Create a Directory Monitor for detecting file changes

To create that directory monitor, go to the Directory Monitor node and click Add.

01-create-monitor-for-list-of-downloads

Give that directory monitor a name (e.g. "Download List Monitor") and select the directory that contains the file where that list of downloads will be generated on.

To prevent the monitor from also monitoring subdirectories that may be found underneath that directory, make sure the Monitor Recursively checkbox is unchecked.

You will also want to uncheck the Monitor interval checkbox. This will allow us to activate this monitor on demand instead of letting it run every x number of seconds. The only time we'll need this monitor is after the download has completed, so letting it run on demand can help us save precious computing resources.

Lastly, in the Events panel, uncheck everything except the Monitor File Change check box.

Once you're done, click the OK button.

02-download-list-monitor

You should then see your newly created directory monitor. See that "run by trigger" under the Interval column? That means this directory monitor can only be activated by a trigger. In the succeeding section, we'll talk about how to make such a trigger.

03-download-list-monitor

2. Create a trigger that will activate the directory monitor

We will now create the trigger that would activate our directory monitor. This will be a time-based trigger, which we'll schedule to run about 12 hours after that scheduled download. Since our download is scheduled to run at 8:30 PM on every first day of the month, we'll set this trigger to run at 8:30 AM the following day. This will give the download ample time to complete.

So now, create a trigger and give it a name (e.g. "Activate Download List Monitor").

Because we want this trigger to run at a predefined schedule, select the Current Time event type. Click Next to proceed.

04-mft-server-current-time-trigger-event

When you get to the Trigger Conditions window, click the Time Expression button and specify the time when you want this trigger to run. In our case, we'd like it to run at 8:30 AM on every second day of the month. Click OK when done.

05-mft-server-time-expression

Click Next to proceed.

06-mft-server-time-expression

Add a new trigger action.

07-mft-server-trigger-action-create

For this purpose, select the Run Directory Monitor trigger action. As its name implies, this trigger action will run a directory monitor.

08-mft-server-run-directory-monitor

When you get to the trigger action parameters, select the name of the directory monitor we created earlier. In our case, that would be "Download List Monitor". Click OK when done.

09-mft-server-run-directory-monitor

Click OK to proceed.

10-mft-server-new-trigger-run-directory-monitor

Don't forget to click the Apply button once you get to the main screen. This will finalise the trigger creation process.

3. Create the trigger that will send the email.

We're now ready to create the trigger that will be responsible for sending the email notification.

Create a new trigger and give it a name (e.g. "Email Download List").

What we want is a trigger that would fire whenever the file containing that list of downloads has changed. Thus, what we need is the Directory Monitor File Changed event type. Select that and click Next.

11-mft-server-new-trigger

Just in case you have several monitors on your server that detect file changes, filter out all other monitors by adding the condition:

MonitorName = "Download List Monitor"

And if you have several files in the directory being monitored by "Download List Monitor", you can likewise filter out other file changes by specifying the file name. Just add the condition: Name = "the name of the file containing the list". Since, in our case, the file is filesdownloaded-moved.txt, then our complete trigger condition would be:

MonitorName = "Download List Monitor" AND Name = "filesdownloaded-moved.txt"

Click Next to proceed.

12-mft-server-trigger-condition

Add a new trigger action and select "Send Email".

13-mft-server-send-email

Enter all the necessary parameters for sending that email notification, including the hostname of your SMTP server, the port number, connection type, etc.

14-mft-server-send-email-parameters

In the Body text box, enter the message you want to relay. And then in the Attachment field, browse to the file you want to send. In our case, it's the filesdownloaded-moved.txt, which contains a list of those files that were automatically downloaded the previous night.

Click OK when done.

15-mft-server-send-email-attachments

16-mft-server-send-email

Finalise the trigger by clicking Apply.

17-mft-server-triggers

Did you like this post? Perhaps you might want to read these as well:

You might want to read these too

How To Send Large Files Through Email

How To Set Up A Server To Server File Transfer

10 Essential Attributes of A Secure File Transfer

Get Started

Want to try this out yourself? Download the free, fully-functional evaluation edition of JSCAPE MFT Server now.

Download JSCAPE MFT Monitor