Mailing details

This topic describes how to process mailing details using field functions.

Use your specific data and recipient list fields, and test the field functions before using them in a mailing.

Displaying an email's dispatch date

To display an e-mail's dispatch date as formatted text, you can use the following Velocity code:

#if($user.data.bmIsOnlineVersion)$DateTimeHelper.formatDate('dd.MM.yyyy', $m2u.created)#else$DateTimeHelper.formatDate('dd.MM.yyyy', $DateTimeHelper.getCurrentDate().getTime())#end

The dispatch date refers to the time when the online version of the email (bmIsOnlineVersion) is created. This is most important for transactional mails, where the actual dispatch of the email only starts as soon as a trigger (such as generated post-click) is fired or an event (such as anniversary) occurs.

Processing the dispatch date

To display the dispatch date plus a defined time period as formatted text, you can use the following Velocity code:

#set($daysToAdd = 50)#if($user.data.bmIsOnlineVersion)$DateTimeHelper.formatDate('dd.MM.yyyy', $DateTimeHelper.addDays($m2u.created, $daysToAdd))#else$DateTimeHelper.formatDate('dd.MM.yyyy', $DateTimeHelper.addDays($DateTimeHelper.getCurrentDate().getTime(), $daysToAdd))#end

The Velocity code adds 50 days to the dispatch date. This is useful, for example, to indicate the validity of promotional offers.

Displaying the sender's address

To display the email's sender's address, you can use the following Velocity code:

$mailing.mailingConfig.messageConfig.header.from.email.render(null)

Displaying the recipient list name

To display the recipient list name, you can use the following Velocity code:

$user.data.userlist.name

To use the recipient list name in a URL, you must encode it first:

$NetHelper.urlEncode($user.data.userlist.name)

Displaying the recipient list ID

To display the recipient list ID, you can use the following Velocity code:

$user.data.userlist.id

Displaying the recipient ID

To display the recipient ID, you can use the following Velocity code:

$user.data.id

Displaying the client ID

To display the client ID, you can use the following Velocity code:

$mailing.mailingGroup.id

Displaying the client name

To display the client name, you can use the following Velocity code:

$mailing.mailingGroup.name

Displaying the mailing name

To display the mailing name, you can use the following Velocity code:

$mailing.name

Displaying the mailing description

To display the mailing description, you can use the following Velocity code:

#if (!$StringHelper.isEmpty($mailing.description))$NetHelper.urlEncode($mailing.description)#else$!{null}unknown#end

The mailing description is displayed URL-encoded, for example This+is+a+test+mailing. If no description is available, unknown is displayed.

Comparing recipients with target groups

To check whether a recipient belongs to a certain target group and display a corresponding text, you can use the following Velocity code:

#if($filter.filterByRevisionedFilters("TARGETGROUPID", false))Foo#else$!{null}Bar#end

In the Velocity code, Foo is the output if the recipient belongs to the target group and Bar is the output if the recipient does not belong to the target group.

Displaying the image host

To display the host of the file server where an image is stored, you can use the following ODR code:

<odr:set value="%{imageHost(m2u)}" var="host"/>
<odr:out value="%{host}"/>

Yo can also display the image host using the following Velocity code:

$!bmOdr.out("%{imageHost(m2u)}")$!{null}