Send an Email
This is one of the Additional Actions supported by WatchFTP and typically sends an email for each downloaded file.
- Complete the fields using the variables below in the message Subject and Body
- 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.
|$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.
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.
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).
<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.
|%a||Abbreviated weekday name|
|%A||Full weekday name|
|%b||Abbreviated month name|
|%B||Full month name|
|%c||Date and time representation appropriate for locale|
|%d||Day of month as decimal number (01 – 31)|
|%H||Hour in 24-hour format (00 – 23)|
|%I||Hour in 12-hour format (01 – 12)|
|%j||Day of year as decimal number (001 – 366)|
|%m||Month as decimal number (01 – 12)|
|%M||Minute as decimal number (00 – 59)|
|%p||Current locale's A.M./P.M. indicator for 12-hour clock|
|%S||Second as decimal number (00 – 59)|
|%U||Week of year as decimal number, with Sunday as first day of week (00 – 53)|
|%w||Weekday as decimal number (0 – 6; Sunday is 0)|
|%W||Week of year as decimal number, with Monday as first day of week (00 – 53)|
|%x||Date representation for current locale|
|%X||Time representation for current locale|
|%y||Year without century, as decimal number (00 – 99)|
|%Y||Year with century, as decimal number|
|%z, %Z||Either the time-zone name or time zone abbreviation, depending on registry settings; no characters if time zone is unknown|