7.5 Notifying Users with Message Templates and Message Stamps

MailMarshal provides two ways of sending notifications by email.

Message stamps are short blocks of text that can be added to an email message. You can use a stamp to add a company disclaimer, or to warn the recipient of a message that MailMarshal has modified it.

Message templates are complete email messages that can be sent to a user or administrator. MailMarshal uses templates for system notifications such as non-delivery reports. You can also use them to provide auto-responders or other custom notices. MailMarshal can use special digest templates to provide users with summary information about quarantined email.

MailMarshal applies message stamps to both HTML and plain text portions of an email message. Message templates can also include plain text and HTML bodies.

Variables can be used in both templates and stamps. Variables are specially formatted strings you can insert in a stamp or template. When MailMarshal uses the stamp or template, it replaces the variables with information about the specific message. This facility allows you to provide detailed information about the actions MailMarshal has taken on a specific message.

7.5.1 Message Templates

Message templates are used when MailMarshal sends a notification email message based on the outcome of rule processing. The most common use of notification messages is to notify appropriate parties when an email message is blocked.

Notifications are a very powerful tool to inform and modify user behavior. When well thought out and constructed, they can save the administrator a lot of time.

You can also use a notification to set up a general auto responder based on message headers or content. For instance, MailMarshal could respond to a message to robot@ourcompany.com with the subject “Send Catalog” by returning the product catalog to the sender as an email attachment.

The same rule can send several notification messages. For instance, if MailMarshal detects a virus you could choose to send different messages to an email administrator, the external sender, and the intended internal recipient of the message.

You can attach files to a notification. Attachments can include the original message, the MailMarshal processing log for the message, and any other file (such as a virus scanner log file).

You can create a template as plain text, HTML, or both. If you choose to create a template with both HTML and plain text bodies, you must edit the two bodies separately. If you choose to create a template with HTML only, MailMarshal will automatically generate a plain text equivalent of the template with similar formatting.

You can include links to images in HTML templates. You cannot embed images.

Information 

Note: In addition to rule notification templates, MailMarshal uses a number of pre-configured templates for administrative notifications (such as delivery failure notifications). For more information about modifying these templates, see “MailMarshal Properties – Advanced”.

 

7.5.2 Creating a Message Template

To work with templates, in the left pane of the Management Console, select Policy Elements. Then select Message Templates from the right pane menu.

To create a message template:

1.In the right pane of the Management Console, select Message Templates.

2.On the Action menu, select New Message Template to open the Message Template window.

3.By default, MailMarshal creates a HTML message body. MailMarshal will automatically generate a plain text equivalent of the message body when using the template. To choose a plain text body or edit both types separately, click Options.

4.To see additional address fields, click Options.

5.Enter a name for the template.

6.Enter appropriate information in the Header Details section. For instance, enter the email address to which replies should be sent in the Return Path field.

Information 

Note: The MailMarshal default configuration includes numerous templates. These are a good source of ideas for the creation of new templates.

 

7.Enter text in the body section. To view the raw HTML, right-click in the HTML pane and select Edit Raw HTML. Edit the HTML, or paste HTML source from another editor, then click Save to return to the message template window.

8.You can attach files to the notification, including the original message, the MailMarshal message processing log, and other files. To attach one or more files, select the appropriate box(es) and enter the file names if necessary.

9.You can use variables marked with braces { }. To see a list of variables available in any field, type { to open a context menu. You can also enter variable names manually. You can use nested variables. For details of the variables available in templates, see “Using Variables”.

Information 

Note: When sending a notification to the original sender of an email message, use the {ReturnPath} variable in the To: field to reduce the chance of looped messages. Do not use the {ReturnPath} variable in the From: field.

 

7.5.3 Creating Digest Templates

The MailMarshal Array Manager uses digest templates to deliver periodic message digests to users who self-manage end-user management folders. For details of digesting, see “Setting Up Message Digests”.

Digest templates are similar to message templates. The key differences are:

You cannot attach files to digest templates.

You must associate each digest template with a message digest. See “Setting Up Message Digests”.

You cannot edit the “To” field. The recipient is controlled by settings of the message digest.

Digest templates support variables specific to the digesting function that are not available in message templates. These variables allow MailMarshal to provide a list of information about several messages within the same notification message. The most important of these variables is the HTML digest table variable $MessageDigestTableHTML. 

The following arguments are available to customize the behavior of this variable. All arguments are optional.

Table 20: Digest detail levels

Detail Level

Results

BRIEF

Single line for each message, with From, Subject, Date, and small portion of message body (default level).

COMPACT

Two lines for each message; portion of message body starts on second line.

VERBOSE

Longer version including up to 200 characters of message body.

Table 21: Digest options

Option

Results

SHOWRELEASE

Show the message release link for each message (default option).

RELEASETRUST

For incoming digests, in addition to the release link, show a “Trust” link for each message (in the Sender column). If the “Trust” link is clicked, release the message and also add the sender to the user’s Safe Senders list.

For the Trust feature to function, SQM must be configured, and user management of safe senders must be enabled (in the Administrator tab of the SQM site).

With SQM Forms authentication, if the digest recipient’s address is not found as a SQM user or alias, MailMarshal creates a SQM user and sends a password email. With SQM Windows authentication, the address must pre-exist as an alias.

NORELEASE

Do not show the message release links.

RELEASEURL=url

Specify the URL path to the Release webpage used for this digest (see example below). Defaults to the URL of the local MailMarshal Spam Quarantine Management website. A URL could be specified, for instance, in the digests for user groups that cannot browse to the default location.

GROUP

Group entries by folder, for digests covering multiple folders.

SHOWFROM=
yes|no

Show the sender address. Defaults to yes.

SHOWTO=yes|no

Show the recipient address. This option will generally be required when digests for multiple users are sent to the same address. Defaults to no.

Example:

{$MessageDigestTableHTML=COMPACT,GROUP,SHOWFROM=no,
RELEASEURL=http://extranet.example.com/SpamConsole
}

For details of other variables available in digest templates, see “Using Variables”.

Information 

Note: To obtain the best results with digest templates, edit the plain text and HTML versions of the template separately using the “Both” option.

 

To create a digest template:

1.In the right pane of the Management Console, select Message Templates.

2.On the Action menu, select Add Digest to open the Digest Template window.

element-digest-template.png 

3.By default, MailMarshal populates the template with basic information. MailMarshal creates separate HTML and plain text message bodies. To choose to use only one of the two types, click Options. 

4.To see additional address fields, click Options.

5.Enter a name for the template.

6.Enter appropriate information in the Header Details section. For instance, enter the email address to which replies should be sent in the Return Path field.

7.Enter text in the body section. To view the raw HTML, right-click in the HTML pane and select Edit Raw HTML. Edit the HTML, or paste HTML source from another editor, then click Save to return to the message template window.

8.You can use variables marked with braces { }. To see a list of variables available in any field, type { to open a context menu. You can also enter variable names manually. You can use nested variables. For details of the variables available in templates, see “Using Variables”.

9.Click Save.

7.5.4 Editing Templates

You can edit a template, including the address information and the message bodies.

To edit a template:

1.Double-click a template name in the Management Console.

2.Make changes then click Save. If you have created both a plain text and a HTML version of the template, remember to change both versions.

7.5.5 Duplicating Templates

You can make a copy of a template if you want to use it as the starting point for another template.

To copy a template:

1.Right-click a template name in the Management Console.

2.Choose Duplicate from the context menu.

3.After duplicating the template, make changes to the copy.

7.5.6 Deleting Templates

You can delete a template if it is not used in any rules.

To delete a template:

1.Select a template in the Management Console.

2.Click the Delete icon in the toolbar.

7.5.7 Working with Message Stamps

Message stamps are short blocks of text that MailMarshal can apply to the top or bottom of an email message body. MailMarshal message stamps can include a plain text and an HTML version. MailMarshal will apply the appropriate stamp format to the body text of the same type in the message.

Many companies use message stamps to apply disclaimers or advertising on outgoing email. MailMarshal can also use a message stamp to notify the recipient that a message has been processed (for example by having an offending attachment stripped).

To work with Message Stamps, in the left pane of the Management Console, select Policy Elements. Then select Message Stamps from the right pane menu.

To create a message stamp:

1.In the right pane of the Management Console, select Message Stamps.

2.On the Action menu, select New Message Stamp.

3.Enter a name for the stamp.

4.Select whether the stamp is to appear at the top or the bottom of messages.

5.Enter a plain text version of the message stamp in the Plain Text tab.

6.Enter an HTML version of the stamp in the HTML tab.

You can apply various formatting, including hyperlinks, to the HTML text using the buttons pro­vided.

You can define and use local CSS classes in a stamp. See Help for details.

To view the raw HTML, right-click in the HTML pane and select Edit Raw HTML. Edit the HTML, or paste HTML source from another editor, then click Save to return to the message stamp win­dow.

7.To add the new stamp to the list of available message stamps, click Save.

Information 

Note: If message stamping is enabled for RTF (Microsoft TNEF) messages, the plain text message stamp will be used for these messages. To enable RTF stamping, see the Engine Advanced section of MailMarshal Properties.

 

Both plain text and HTML message stamps can include the same variables available within email notification templates.

7.5.7.1 Duplicating Message Stamps

You can make a copy of a stamp if you want to use it as the starting point for another stamp.

To duplicate a message stamp:

1.Right-click the stamp name in the Management Console.

2.Choose Duplicate from the context menu.

3.After duplicating the message stamp, make any required changes to the copy. Remember to make changes to both the Plain Text stamp and the HTML stamp.

7.5.7.2 Editing Message Stamps

You can make changes to a stamp. Remember to make changes to both the Plain Text stamp and the HTML stamp.

To edit a message stamp:

1.Double-click the stamp name in the right hand pane of the Management Console.

2.Make the required changes.

3.Click Save.

7.5.7.3 Deleting Message Stamps

You can delete a message stamp if it is not used in any rules.

To delete a message stamp:

1.Select the stamp in the right hand pane of the Management Console.

2.Click the Delete icon in the toolbar.

7.5.8 Using Variables

You can use variables when you create a message template, digest template, message stamp, or message classification description, and also in the field substitution of content analysis Header Rewrite rules. MailMarshal substitutes the appropriate information when processing each message or digest.

Variables are marked by curly braces { }. You can select from available variables in any field where they are available in a template, stamp, or classification. To see a list of available variables in a specific field, type { .

Not all variables are available in all contexts. MailMarshal may not have the required information to substitute. In particular, if a message is deadlettered, information about the message content is not available. If MailMarshal does not have any data, it will enter empty text into the variable marker or return the variable marker text.

The following table lists commonly used variables and their functions:

Table 22: MailMarshal variables

Variable

Data inserted

{$MessageDigestTableHTML
=detail[,option,option,...]}

The HTML version of a message digest detail listing. For full information about options, see “Creating Digest Templates”.

See also the variable {MessageDigestTableText}.

{Administrator}

Email address of the administrator as set during post-installation configuration and accessible from the Notifications section of MailMarshal Properties.

{ArrivalTime}

The time when MailMarshal received a message.

{AttachmentName}

File name of the attached file that triggered a rule condition.

{CmdFileName}

Full path to a file unpacked from the message being scanned. Used in the parameters of an External Command or Command Line Virus Scanner to take action on a specific file.

{Date}

The current date. For more information, see “Date Formatting”.

{DateLastRun}

The date of the previous MailMarshal message digest for a folder.

{Errorlevel}

The last error returned by a virus scanner or an external command.

{ExternalCommand}

The name of the last External Command used.

{Env=varname}

Inserts the value of a Windows environment variable.

{ExternalSender}

Returns 'y' or 'n' depending on whether the sender was outside or inside the “allowed to relay” space.

{File=fullpath}

Inserts a text file within the body of a message (for instance, can be used to insert the MailMarshal log for a message in a notification email body).

{Folder}

The name of the folder that is the subject of a MailMarshal message digest email.

{FolderRetention}

The retention period for a folder that is the subject of a MailMarshal message digest email.

{FormattedRecipients}

Available in Engine dead letter templates only. Lists recipients of the message (in the To: or CC: fields), formatted for use in the message body.

{FormattedRecipientsAffected}

Available in Sender templates only. Where a message could not be send to some recipients (in the To: or CC: fields), shows the affected recipients of the message, formatted for use in the message body.

{From}

Email address in the 'From' field of the message.

{HasAttachments}

Returns '1' if the message has attachments.

{Header-Reply-To}

Email address in the 'Reply-To' header of the email message. If the 'Reply-To' header is not present, the return-path email address is used.

{HelloName}

Name given by the remote email server when MailMarshal received this message.

{Hostname}

The host name of the server.

{If variable}...[{else}...]{endif}

Allows conditional substitution of text. The condition is true if the variable is not empty. For example: {If VirusName}This message contained the virus {VirusName}.{endif}

The Else clause is optional.

{InitialMessageBody}

The first 200 characters of the body of the message.

{Install}

The install location of MailMarshal.

{LastAttemptDate}

The date and time of the most recent attempt to deliver the message.

{LastTextCensorRuleTriggered}

The name of the TextCensor Script that was run and the phrase that triggered.

{LocalRecipient}

The message recipient, if any, within the local domains. Includes multiple recipients, CC and BCC recipients.

To preserve the privacy of BCC recipients when sending notifications, do not use this variable in the template TO: field or in the body of the template. Place this variable in the BCC: field.

{LocalSender}

The message sender, if any, within the local domains.

{LogName}

The name of the Logging Classification used.

{Message-ID}

Original SMTP Message ID of the message.

{MessageFullName}

Full path to the message file.

{MessageCount}

The number of messages quarantined for a user in a specific folder and listed in a message digest email.

{MessageDigestTableText}

The plain text version of a message digest detail listing. See also {$MessageDigestTableHTML}.

Note: The plain text version does not use any detail level or option settings.

{MessageName}

Filename only of the message.

{MessageSize}

The size of the message as originally received.

{MMSmtpMapsRBL}

Note: This variable name is deprecated. Use {ReputationServices}.

{PolicyGroupTitle}

The title of the policy group containing the rule triggered by the message. Replaces {RulesetTitle}.

{RawSubject}

Message subject with any encoding included, as originally received. Use this variable to include the subject in the Subject field of notification templates. See also {Subject}.

{Recipient}

Message recipient. Includes multiple recipients and CC recipients.

{ReleasePassThrough}

Inserts a code recognized by the gateway to release the message applying no further rules. See “Using the Message Release External Command”.

{ReleaseProcessRemaining}

Inserts a code recognized by the gateway to release the message applying any additional applicable rules. See “Using the Message Release External Command”.

{RemoteDomainName}

The name of the domain on the remote machine (connecting email server).

{RemoteIP}

The IP of the remote machine.

{ReplyTo}

SMTP “Mail From” email address.

{ReputationServices}

A list of Reputation Services (DNS blocklists) that triggered on the message within a Connection Policy rule. Does not include information generated by the Category Script (SpamCensor) process.

{ReturnPath}

SMTP “Mail From” email address.

{RuleTitle}

The title of the rule triggered by the message.

{Sender}

Email address of the sender. Uses the address in the “From” field unless it is empty, in which case the SMTP “Mail From” email address is used.

{SenderIDFrom}

The address used for the Sender ID check.

{SenderIDIPAddress}

The IP address used for the Sender ID check.

{SenderIDResult}

The result of the Sender ID check (Pass, Fail, None, SoftFail, Neutral, TempError, or PermError).

{SenderIDReturnedExplanation}

The text explanation returned from the Sender ID query (if any).

{SenderIDScope}

The scope of the Sender ID check (pra or mfrom).

{SenderIP}

IP address of the sender.

{ServerAddress}

Email address used as the 'From' address for notifications as set during post-installation configuration and accessible from the Notifications section of MailMarshal Properties.

{SpamBotCensorResult}

The result string as returned by the SpamBotCensor facility.

{SpamBotCensorScore}

The numeric score as returned by the SpamBotCensor facility.

{SpamCategoryResult}

The result string as returned by a Category script rule condition (other than SpamCensor or SpamBotCensor). If you run more than one Category condition on a message, this variable returns only the result of the latest condition (at the time the variable is used).

{SpamCategoryScore}

The numeric score as returned by the latest Category script rule condition (other than SpamCensor or SpamBotCensor). If you run more than one Category condition on a message, this variable returns only the score of the latest condition (at the time the variable is used).

{SpamCensorResult}

The result string as returned by the SpamCensor facility.

{SpamCensorScore}

The numeric score as returned by the SpamCensor facility.

{SPFExplanation}

The default explanation configured in the SPF Settings window, or the text explanation returned from the SPF query (if any)

{SsmUrl}

The URL of the MailMarshal Spam Quarantine Management Website. You can change this value on the Administrator tab of the SQM website.

{StrippedFiles}

The names of any attachment files stripped from the message by rule action.

{Subject}

Message subject, decoded if applicable. Use this variable in most cases. See also {RawSubject}.

{ThreadWorking}

The MailMarshal working folder name.

{Time}

The current time. See also “Date Formatting”.

{TimeEnteredQueue}

The time that the message entered the MailMarshal Queue.

{TimeLeft}

The time left to attempt delivering the message in question.

{UnsubscribeUrl}

The URL used to unsubscribe from digests. This variable can be used in digest templates. The variable evaluates blank if a user cannot unsubscribe. Suggested usage:
{if UnsubscribeUrl}To unsubscribe from this digest, use the following link: {UnsubscribeUrl} {endif}

{VirusName}

Name of the virus detected. This information is only available if the virus scanner being used is a DLL based scanner. If a command line scanner reports a virus this variable is set to “Unknown.”

{VirusScanner}

Name of the virus scanner used.

7.5.9 Date Formatting

When you use dates in variables within message templates, message stamps, and logging classifications, you can include formatted dates. This feature is especially useful to avoid confusion about the order of day, month, and year in dates.

To use date formatting, include the template variable {date=%%var} where var is one of the sub-variables from the table below. You can include more than one sub-variable within the same date variable. For instance {date=%%d %%b %%Y} would return 07 Apr 2004.

Information 

Note: Each sub-variable must be preceded by %%. For example, to ensure that the date is formatted according to the Windows locale, use {date=%%c}.

To use locale-specific settings you must ensure that the Windows locale is applied to the account used by MailMarshal services. For more information, see Trustwave Knowledge Base article Q12670.

 

The following table lists the available date formatting sub-variables:

Table 23: Date formatting variables

Variable

Value inserted

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

Time-zone name or abbreviation; no characters if time zone is unknown

Trustwave MailMarshal 10.1.0 User Guide February 2024
< Previous Section   |   Next Section >
Full document: see MailMarshal Documentation.