4 min read

Enhancing messages using built-in placeholders

For simple functionality’s sake, we generally want our phpList messages to contain at least a small amount of customization. For example, even the default footer, which phpList attaches to messages, contains three placeholders, customizing each message for each recipient:


If you do not want to receive any more newsletters, [UNSUBSCRIBE]

To update your preferences and to unsubscribe, visit [PREFERENCES]

Forward a Message to Someone [FORWARD]


The placeholders [UNSUBSCRIBE],[PREFERENCES], and [FORWARD] will be replaced with unique URLs per subscriber, allowing any subscriber to immediately unsubscribe, adjust their preferences, or forward a message to a friend simply by clicking on a link.

There’s a complete list of available placeholders documented on phpList’s wiki page at http://docs.phplist.com/Placeholders. Here are some of the most frequently used ones:

  • [CONTENT]: Use this while creating standard message templates. You can design a styled template which is re-used for every mailing and the [CONTENT] placeholder will be replaced with the unique content for that particular message.
  • [EMAIL]: This is replaced by the user’s e-mail address. It can be very helpful in the footer of an e-mail, so that subscribers know which e-mail address they used to sign up for list subscription.
  • [LISTS]: The lists to which a member is subscribed. Having this information attached to system confirmation messages makes it easy for subscribers to manage their own subscriptions. Note that this placeholder is only applicable in system messages and not in general list messages.
  • [UNSUBSCRIBEURL]: Almost certainly, you’ll want to include some sort of “click here to unsubscribe” link on your messages, either as a pre-requisite for sending bulk mail (perhaps imposed by your ISP) or to avoid users inadvertently reporting you for spamming.
  • [UNSUBSCRIBE]: This placeholder generates the entire hyperlink for you (including the link text, “unsubscribe”), whereas the [UNSUBSCRIBEURL] placeholder simply generates the URL. You would use the URL only if you wanted to link an image to the unsubscription page, as opposed to a simple link, or if you wanted the HTML link text to be something other than “unsubscribe”.
  • [USERTRACK]: This inserts an invisible tracker image into HTML messages, helping you to measure the effectiveness of your newsletter.

You might combine several of these placeholders to add a standard signature to your messages, as follows:


You ([EMAIL]) are receiving this message because you subscribed to
one or more of our mailing lists.

We only send messages to subscribers who have requested and
confirmed their subscription (double-opt-in). You can adjust
your list membership at any time by clicking on [PREFERENCES] or unsubscribe altogether by clicking on [UNSUBSCRIBE].


Placeholders in confirmation messages

Some placeholders (such as [LISTS]) are only applicable in confirmation messages (that is, “thank you for subscribing to the following lists…”). These placeholders allow you to customize the following:

  • Request to confirm: Sent initially to users when they subscribe, confirming their e-mail address and subscription request
  • Confirmation of subscription: Sent to users to confirm that they’ve been successfully added to the requested lists (after they’ve confirmed their e-mail address)
  • Confirmation of preferences update: Sent to users to confirm their updates when they change their list subscriptions/preferences themselves
  • Confirmation of unsubscription: Sent to users after they’ve unsubscribed to confirm that their e-mail address will no longer receive messages from phpList

Personalizing messages using member attributes

Apart from the built-in placeholders, you can also use any member attributes to further personalize your messages. Say you captured the following attributes from your new members:

  • First Name
  • Last Name
  • Hometown
  • Favorite Food

You could craft a personalized message as follows:

Dear [FIRST NAME],

Hello from your friends at the Funky Town Restaurant. We hope the
[LAST NAME] family is well in the friendly town of [HOMETOWN].

If you’re ever in the mood for a fresh [FAVORITE FOOD], please
drop in – we’d be happy to have you!


This would appear to different subscribers as:

Dear Bart,

Hello from your friends at the Funky Town Restaurant. We hope the
Simpson family is well in the friendly town of Springfield.

If you’re ever in the mood for a fresh pizza, please drop in – we’d
be happy to have you!


Or:

Dear Clark,
Hello from your friends at the Funky Town Restaurant. We hope the
Kent family is well in the friendly town of Smallville.

If you’re ever in the mood for a fresh Krypto-Burger, please drop
in – we’d be happy to have you!


If a user doesn’t have an attribute for a particular placeholder, it will be replaced with a blank space. For example, if user “Mary” hadn’t entered any attributes, her message would look like:

Dear,

Hello from your friends at the Funky Town Restaurant. We hope the
family is well in the friendly town of .

If you’re ever in the mood for a fresh , please drop in – we’d be
happy to have you!


If the attributes on your subscription form are optional, try to structure your content in such a way that a blank placeholder substitution won’t ruin the text. For example, the following text will look awkward with blank substitutions:

Your name is [FIRST NAME], your favorite food is [FAVORITE FOOD],
and your last name is [LAST NAME]


Whereas the following text would at least “degrade gracefully”:

Your name: [FIRST NAME] Your favorite food: [FAVORITE FOOD] Your last name [LAST NAME]



Subscribe to the weekly Packt Hub newsletter. We'll send you this year's Skill Up Developer Skills Report.

* indicates required

LEAVE A REPLY

Please enter your comment!
Please enter your name here