Pre- and Post-Processing (Prepost) |
Configure the email notification, a prepost application.
Email Notification is a built-in Pre- and Post-Processing application that generates customized emails based on transfer events. Your server should have Pre- and Post-Processing configured in order to run this application. Refer to Setting Up Pre/Post. Email Notification requires an SMTP server that matches the following configurations:
Follow these steps to set it up:
Open the aspera.conf file:
/opt/aspera/etc/aspera.conf
Locate or create the section <EMAILNOTIF>...</EMAILNOTIF>:
<CONF version="2"> ... <EMAILNOTIF> <MAILLISTS mylist = "asperausers@example.com, admin@example.com" myadminlist = "admin@example.com" /> <FILTER MAILLISTS = "mylist" TARGETDIR = "/content/users" /> <MAILCONF DEBUG = "0" FROM = "asperaserver@example.com" MAILSERVER = "mail.example.com" SUBJECT = "Transfer %{SOURCE} %{TARGET} - %{STATE}" BODYTEXT = "Aspera transfer: %{STATE}%{NEWLINE}%{TOTALBYTES} bytes in %{FILECOUNT} files: %{FILE1}, %{FILE2}, ...%{FILELAST}." /> </EMAILNOTIF> </CONF>
You can find the aspera.conf example in this path:
/opt/aspera/etc/sample/aspera-sample.email.conf
<MAILCONF /> defines the general email configuration, including the sender, the mail server, and the body text. In the SUBJECT and BODYTEXT options, the Pre- and Post-Processing variables can be used with the format %{variable}, such as %{STATE} for the variable STATE. For the complete list of the variables, Refer to Pre/Post Variables.
MAILCONF Field | Description | Values | Example |
---|---|---|---|
FROM | Required The e-mail address to send notifications from. | a valid email address | FROM="admin@example.com" |
MAILSERVER | Required The outgoing mail server (SMTP). | A valid URL | MAILSERVER="mail.example.com" |
SUBJECT | General subject of the e-mail. | text string | SUBJECT="Transfer:%{STATE}" |
BODYTEXT | General body of the e-mail. | text string | BODYTEXT="Transfer has %{STATE}." |
DEBUG | Print debugging info and write to the logs. | "0" = off, "1" = on | DEBUG="0" |
<MAILLISTS /> defines sets of mailing lists. For example, to create the following mailing list:
Item | Value |
---|---|
Mailing list name | list1 |
Emails to include | janedoe@companymail.com, johndoe@companymail.com |
Specify the mailing list in the form:
<MAILLISTS list1 = "janedoe@companymail.com, johndoe@companymail.com" />
<FILTER /> defines E-mail Notification conditional filters. When the conditions are met, a customized email will be sent to the indicated mailing list. Multiple filters are allowed.
The values in the filter are matched as substrings, for example, USER = root means the value would match strings like root, treeroot, and root1. The Pre- and Post-Processing variables can be used with the format %{variable}, such as %{STATE} for the variable STATE. For the complete list of the variables, Refer to Pre/Post Variables.
FILTER Field | Description | Values | Example |
---|---|---|---|
MAILLISTS | Required The e-mail lists to send to. Separate lists with comma (,). | text string | MAILLISTS="mylist" |
USER | Login name of the user who transferred the files. | text string | USER="asp1" |
SRCIP | Source IP of the files. | a valid IPv4 address | SRCIP="10.0.1.1" |
DESTIP | Destination IP of the files. | a valid IPv4 address | DESTIP="10.0.1.5" |
SOURCE | The top-level directories and files that were transferred. | text string | SOURCE="/folder1" |
TARGETDIR | The directory that the files were sent to. | text string | TARGETDIR="/folder2" |
SUBJECTPREFIX | The Email subject, preceded by the SUBJECT in <MAILCONF />. | text string | SUBJECTPREFIX="Sub" |
BODYPREFIX | The e-mail body, preceded by the BODYTEXT in <MAILCONF />. | text string | BODYPREFIX="Txt" |
TOTALBYTESOVER | Send e-mail when total bytes transferred is over this number. This only applies to e-mails sent at the end of a transfer. | positive integer | TOTALBYTESOVER="9000" |
SENDONSESSION | Send e-mail for the entire session. | yes / no | SENDONSESSION="yes" |
SENDONSTART | Send e-mail when transfer is started. This setting is dependent on SENDONSESSION="yes". | yes / no | SENDONSTART="yes" |
SENDONSTOP | Send e-mail when transfer is stopped. This setting is dependent on SENDONSESSION="yes". | yes / no | SENDONSTOP="yes" |
SENDONFILE | Send e-mail for each file within a session. | yes / no | SENDONFILE="yes" |