Monitor FTP sites with WatchFTP Monitor FTP sites with WatchFTP


  screenshot of this window

Send an Email

This is one of the Additional Actions supported by WatchFTP and typically sends an email for each downloaded file.

  1. Complete the fields using the variables below in the message Subject and Body
  2. Click SMTP Server to enter your SMTP Server settings

Subject: The subject for your email. You can use variables (see below) that will be replaced at runtime.

Message Body: The message body of this email. You can use variables (see below) that will be replaced at runtime.

To, CC, BCC...: Enter one or more email addresses that will receive this message. Multiple addresses are separated by commas.

One email per download: Send an email for each downloaded file. If this option is not selected, only a single email is sent for all downloaded files.

Selecting this option also enables the Environment Variables supported by the Start a Batch script action. Note that those variables are surrounded by %percentage% signs, not dollar-signs.

SMTP Server: Enter the settings for your SMTP Server here.

Variables

$DATE$Current date.
$TIME$Current time.
$WFILE$Windows Filename of the downloaded file.
If you did not select One email per download this variable contains the list of the downloaded files and is ignored in the message subject.
$UFILE$The Unix Filename of the downloaded file, including its full path (/home/monitor/sub/file.txt).
If you did not select One email per download this variable contains the list of the Unix filenames and is ignored in the message subject.
$UFILENAME$Just the name of the Unix file, without path (file.txt).
$UDIR$Just the location (path) of the Unix file, without the filename (/home/monitor/sub).
$UPDIR$Just the name of the parent directory of the Unix file (sub).

How $DATE$ and $TIME$ are formatted is controlled by the date and time format string, see further down below.

If you selected One email per download, you can also include Environmental Variables surrounded by percentage signs.

Repeat Blocks

If you have not selected "One email per download", WatchFTP sends just one email for all downloaded files. Inside the message body of this email you can write a "repeat block" that will be repeated for each file. Inside those repeat blocks you can also use Environmental Variables that will be replaced by correct values for the "current" file.

For a Repeat-Block example, see HTML Email below.

HTML Email

If you want to send nicely formatted emails, you can let WatchFTP send them in HTML format. To make sure WatchFTP recognizes it should enable html, make sure your message body starts with <html> (in lower case).

Example:

<html>
<body bgcolor="#E6E6FA">
Hello!<br><br>

#REPEAT#
The FTP file <b>$UFILE$</b> has just been
downloaded to <b>$WFILE$</b> (%WF_FILE_SIZE_KB% kilobytes).<br>
#ENDREPEAT#
</body>
</html>

Date and Time Format

Here you can enter a format string to control how the $DATE$ and $TIME$ strings are formatted. As an example, enter %#m/%d/%Y for month/day/year. The # (%#m in the example) removes leading zeroes.
The table below shows the list of formatting codes you can use.

%aAbbreviated weekday name
%AFull weekday name
%bAbbreviated month name
%BFull month name
%cDate and time representation appropriate for locale
%dDay of month as decimal number (01 – 31)
%HHour in 24-hour format (00 – 23)
%IHour in 12-hour format (01 – 12)
%jDay of year as decimal number (001 – 366)
%mMonth as decimal number (01 – 12)
%MMinute as decimal number (00 – 59)
%pCurrent locale's A.M./P.M. indicator for 12-hour clock
%SSecond as decimal number (00 – 59)
%UWeek of year as decimal number, with Sunday as first day of week (00 – 53)
%wWeekday as decimal number (0 – 6; Sunday is 0)
%WWeek of year as decimal number, with Monday as first day of week (00 – 53)
%xDate representation for current locale
%XTime representation for current locale
%yYear without century, as decimal number (00 – 99)
%YYear with century, as decimal number
%z, %ZEither the time-zone name or time zone abbreviation, depending on registry settings; no characters if time zone is unknown
%%Percent sign