Administration Guide : Trigger Set Configuration : The email Action

The email Action
The email Action provides more opportunity for customizing than any other Action shipped with Xinet.  Each entry in an email Action Setting is a string that may include tagged names of Environment Variables to swap in. The tags are formatted like $VARIABLE or ${VARIABLE}, and if VARIABLE is available in the environment, the variable’s value is used instead (otherwise, $VARIABLE will remain). Though it is not necessary to “tokenize” these tags by including them in curly brackets ({}), Xinet recommends you do so for consistent results. The email Action is also used to notify users when a Trigger Set Action did not complete successfully.
The email Action can send plain text or HTML-formatted messages. If the Body field of an email Action Setting starts with either <html or <!doctype html, the email is presumed to be HTML-formatted. In this case, proper email headers are added to inform email-reading programs that the mail should be interpreted as HTML, and some variable replacements work differently (especially image attachments). Otherwise, the email Body is assumed to be plain text.
Additional Email Variables
In addition to the Environment Variables mentioned in The Action Environment, the email Action sets additional variables of its own, and the program that implements the email Action recognizes a few more. These include:
FOREACHFILE, ENDFOREACH
When triggered by an Aggregated Upload event, surround a section of the email body that will be repeated for each uploaded file. See the examples below for a possible email body.
FID
Venture File ID of FILENAME
PARENTID
Venture File ID of parent folder of FILENAME
XFILE
The filename and the path to it on the server. Equivalent to FILENAME and maintained for backwards compatibility only.
XFILESHORT
This is only the filename itself, without any path information.
XKEY
This is the name of the keyword used to initiate the Action.
XHTMLPATH
HTML-ready representation of the full path to the file. Equivalent to HTMLPATHNAME and maintained for backwards compatibility only.
XHTMLSHORT
The last file component of $HTMLPATHNAME.
XUSER
Xinet user name. Equivalent to USERNAME and maintained for backwards compatibility only.
XFID
This is the Xinet FileID associated with $PATHNAME.  It  will be 0 if the database FileID can’t be determined.
XWNUSEREMAIL
This is the email address of the user who committed the  trigger that caused the Action (which is normally set in the $USERNAME environment variable).  If that user doesn’t have an email address stored in the Xinet database, this is equivalent to $USERNAME.
XWNUSERMAILTO
This is the Upload email address for $USERNAME, if set, or the default Upload email address, if set. If neither are set, the variable string will remain untouched. If both are set, the user’s own setting always takes precedence.
XDEFAULTEMAIL
 Gets replaced by the default Upload email address.  If there is none, the variable string will remain untouched.
XLARGEPREVIEW, XSMALLPREVIEW
Pulls the large or small WEB preview from the Xinet database (or the filesystem) for $FILENAME and includes it in the email.  If the email is HTML-formatted, it’s included and named so that it’s part of the HTML.  You can either put the variable in like this:
<IMG src=$XLARGEPREVIEW blah=foo>
or just put $XLARGEPREVIEW in randomly (not after a src=) and the email Action will create an <IMG> object for it. Note that if either Web preview is not available, the email Action will wait up to five minutes for it to appear before giving up and sending a proxy image. This behavior makes it possible to trigger this Action from a File Create event.
  If you're doing something fancy in JavaScript and need to “fake out” this IMG-creation convention, you could write something like this:
var my_fancy_image_src="$XLARGEPREVIEW"
and that would be replaced by the same string that would be used for the src= parameter inside an IMG object. There can be no space characters around the = sign.
Optionally, the XLARGEPREVIEW tag (and only that tag) may be written this way:
${XLARGEPREVIEW=pXXX,bRRGGBB}
and the large preview will be scaled (and/or padded) to a XXX-by-XXX-pixel image, using the Hex-encoded RGB values for the padding and/or transparent pixels.  The ,bRRGGBB part may be omitted to get a default white background.
{XEMBEDPATH=/path/to/image}  
Just like the X*PREVIEWs, above, except the local server path to the image is included as part of the replaceable tag. If the path doesn't resolve to a real file, a generic proxy is sent instead. Supported image formats are GIF, JPEG and PNG.
Only XEMBEDPATH and the parameterized XLARGEPREVIEW tags are required to be written with curly braces so their parameters are unambiguously attached to the tag name.
XATTACHFILE
Only works with non-HTML-formatted e-mail bodies and causes the file associated with the Action (the path in $FILENAME) to get attached to the e-mail.
Email examples
The following are examples of email messages that use these fields. They are placed in the Body field of the Action Setting.
Example 1:
The file "${XFILESHORT}" has had "${XKEY}" changed or updated by ${USERNAME}. The value of ${KEYWORD65_NAME} for "${XFILESHORT}" is ${KEYWORD65_VALUE}. You can see this file for yourself at:
http://server.domain.com/webnative/imageinfo?${URLPATHNAME}.
Sincerely,
Your server
Example 2 (when triggered by an aggregated upload, file names are provided for each file uploaded):
Dear $USERNAME,
Thank you for uploading the following assets to our server.
$FOREACHFILE
FILENAME: $XFILESHORT
Jobname: $KEYWORD123_VALUE
$XSMALLPREVIEW
$ ENDFOREACH
Best regards,
Your Xinet Server