phpList 2 E-mail Campaign Manager: Personalizing E-mail Body


PHPList 2 E-mail Campaign Manager

PHPList 2 E-mail Campaign Manager

Get to grips with the PHPList e-mail announcement delivery system!

        Read more about this book      

(For more resources on this subject, see here.)

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 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:


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!


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:


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]

        Read more about this book      

(For more resources on this subject, see here.)

Sending messages to subsets of lists based on attributes

The techniques we've discussed so far apply to messages sent to all the members of a particular list. You can also use user attributes to define a target subset of members to which a particular message should be sent.

Let's say you wanted to e-mail only members who lived in Albania, whose favorite food is pizza. When composing your message, click on the Criteria tab to add criteria based on attributes. Select the applicable attributes and remember to check the Use this one checkboxes where applicable:

After clicking on Save Changes, you can proceed to compose and send the message as you normally would. It will only be sent to users whose criteria match your selections.

Note that criteria-based selections don't work with plain text attributes, as the members' attributes can't be matched against previously known values. Only select, radio, or checkbox attributes are available.

Increasing the amount of criteria available

By default, phpList only allows you two selection criteria when sending messages based on user attributes. To increase the amount of criteria available, you'll need to edit config/config.php.

On line #296 in config/config.php, change the 2 in the line below to the maximum amount of criteria you need:

define ("NUMCRITERIAS",2);

Let's assume you want a maximum of 5 criteria available for selection (you don't have to use them all). Change the NUMCRITERIAS variable as follows:

define ("NUMCRITERIAS",5);

Now while selecting criteria when composing a message, there are five criteria available for use:

Using message templates

So far, we've used placeholders and attributes to customize individual messages. phpList also allows us to create message templates, so that all the repetitive parts of a message (styling, footer, and so on) can remain consistent and "out of the way".

Creating a message template

To create or manage message templates, click on the templates link on the right-hand navigation panel:

You are taken to the phplist - templates in the system page. All the templates you've defined will be listed here. Click on add new template to create a new template:

Either upload a pre-existing HTML file to use as a template or compose one using the WYSIWYG editor. Remember to insert the placeholder [CONTENT] where you want the dynamic content to be inserted when the message is sent:

Below the message compose window, above the Save Changes button, are options controlling the checking of external links and URLs:

If you reference local images in your template, phpList will prompt you to upload these; in that case, they will be attached to each message upon sending.

Click on Save Changes to save your template. In this example, phpList acknowledges that there are no local images referenced in the template. Click on send a message to compose a new message using this template:

Compose your message (just the dynamic content), save at least once, and then click on the Format tab to select a template:

Select your template and then continue to send the message as normal:

The content you entered replaces the [CONTENT] placeholder in the template:


In this article, you've learned to use built-in placeholders and user attributes to personalize the e-mails you send to your subscribers. You've learned about using built-in placeholders and custom attributes, selecting criteria when sending messages, and taking advantage of templates to provide a consistent look to your messages.

In this article, we have covered:

  • Enhancing messages with built-in placeholders
  • Personalizing messages using member attributes
  • Sending messages to subsets of lists based on attributes
  • Using message templates for consistent layout and styling

Further resources on this subject:

You've been reading an excerpt of:

phpList 2 E-mail Campaign Manager

Explore Title