Personalize Newsletter with Shortcodes
You can personalize your newsletters by including shortcodes which will show more information about your subscribers, about your content, specific dates, etc.
They work in two different places:
- In the Subject line of your newsletter;
- In the Email Editor.
Quick link: See the full list of available shortcodes
In the Subject line
Simply add the shortcode of your choice in the Subject line of your newsletter:
In the Email Editor
To add a shortcode or a default text (where the information is missing), click on any text block inside the newsletter designer and use the following button:
You will see a full list of available shortcodes. Just click on the ones you want to be added to your text block.
First and last name shortcode
Useful for when you want to refer to your subscribers first or last name (assuming you collect this information in a subscription form):
[subscriber:firstname | subscriber:lastname | default:subscriber]
The text after the parameter "default" will be used when the first name or last name is not found on the subscriber's records. By using word "subscriber" it will display "Hey, subscriber!"
Getting creative with the [user] shortcode
If you want to display just the first name, use this:
Howdy [subscriber:firstname | default:subscriber], how are you today?
If your subscriber full name is John Doe, and you send him the newsletter, he will see the message: Howdy John, how are you today?
If you want to use his full name (which is tricky because you have to be creative for email-only subscribers):
Hello [subscriber:firstname | default:Comrade] [subscriber:lastname | default:of our ship]!
This would display one of these 3 combinations if the recipient is called John Doe:
- Hello John Doe!
- Hello Comrade Doe!
- Hello Comrade of our ship!
Full list of available shortcodes
Subscriber:
- First Name: [subscriber:firstname | default:subscriber]
- Last Name: [subscriber:lastname | default:subscriber]
- Email Address: [subscriber:email]
- WordPress user display name: [subscriber:displayname | default:subscriber]
- Total number of subscribers
- Custom fields
Newsletter:
- Newsletter Subject: [newsletter:subject]
Post Notifications:
- Show number of posts or pages: [newsletter:total]
- Show Most Recent Post Title: [newsletter:post_title]
- Display the Issue Number for Post Notification emails: [newsletter:number]
- Display a list of past newsletters on a page: [mailpoet_archive]
Date:
- Current day of the month number: [date:d]
- Current day of the month in ordinal form, ie. 2nd, 3rd, etc : [date:dordinal]
- Full name of current day: [date:dtext]
- Current month number: [date:m]
- Full name of current month: [date:mtext]
- Year: [date:y]
- Relative dates: [date:custom | format:l jS F Y \a\t ga] will produce "Tuesday 10th January 2017 at 9am". The format values must be compatible with the PHP Date Formats.
Links (only available for the newsletter editor):
- Unsubscribe link: [link:subscription_unsubscribe_url]
- Edit subscription page link: [link:subscription_manage_url]
- View in browser link: [link:newsletter_view_in_browser_url]
Site:
- Site title: [site:title]
- Homepage link
- Homepage URL: [site:homepage_url]
Create your own custom shortcode
Please read this article for more information on adding your own shortcodes.