Joomla 4 introduced a new way to customize the automated emails the CMS sends to users. This applies to Joomla 4 and 5. These custom messages are called Mail Templates.
With mail templates, you can easily create custom user registration emails, password reset emails, forgotten username emails, and more. You may access the mail templates by navigating to System – Templates – Mail – Templates in the backend.
There are a few dozen default mail templates displayed in the Mail Template manager. Each template has a title, a related extension, and a short description of what the template it’s for.
There are many similar, but slightly different templates to choose from. So knowing which template to use is important.
Before you can use Mail templates, your website must support email. Ensure your mail settings are properly configured in the Global Configuration and test that you can receive emails from your website.
User Registration and Account Mail Templates
Most of the emails sent to users will likely be tied to the Users component. Emails are sent to users when they register new accounts, activate their accounts, reset their passwords, and more. Let’s take a look at the general format for modifying a template.
New Account With Self Activation
The “Users: New account with self-activation” template defines the message sent to users when they register a new account with self activation enabled. Self-activation is when the user clicks a link to activate their account. This is the most common form of account activation. If you selected a different form of account activation in the Users component (no activation or admin activation) you will need to modify the corresponding template for those modes.
There’s one mail template “Users: New account with self-activation” and another, very similar one “Users: New account with self-activation (with PW)”. The “with PW” template includes a copy of the user’s password, if you opted to send a copy of their password in the User’s component settings. For security reasons, I do not recommend you send the user’s password with their activation. We will be looking at the first option, without the password.
When you open a mail template, you will see fields for the Email’s subject and message. This is where you may begin customizing the template with your own content.
On the right side, Joomla displays different tags which you may insert into your message. These tags are strings of text which get replaced with the relevant user details when the messages are sent out. For example, the {NAME} tag is replaced with the name the user entered when they registered their account.
Here’s a description of what each tag does:
- {NAME}
- This tag is replaced with the full name the user entered when they registered. This is NOT the username.
- {USERNAME}
- This tag is replaced with the username the user entered when they registered.
- {SITENAME}
- The name of your website, as defined in the Global Configuration.
- {ACTIVATE}
- This is the direct link the user must click to activate their account.
- {SITEURL}
- This is your website’s base address – mywebsite.com
Sample Modification
Here’s an example of what a modified version of this template might look like.
{USERNAME}, Thanks for registering at Kevin's Blog! To complete your user account activation, please copy/paste the following activation link into your browser. Activation Link: {ACTIVATE} We look forward to having you join us. Thank you, Kevin's Blog Management Team
I have modified my template to use the user’s username instead of their real name. I’ve also personalized it with some custom text, to be a little more informal. You could also use this as a marketing opportunity to tell the user about the features of their account, how to use your website, or promoted services/products.
I’d encourage you to test your email templates to make sure they work by registering a test account on your website. If you spelled a tag incorrectly, the relevant information may not be given to the users. Ensure your mail templates are properly written and reviewed for spelling/grammar, so your website appears professional.
I’m not going to go into detail on what every single template does, as the description should suffice. If you need additional help, or are confused by anything, feel free to post a comment at the end of this page.
Mail Template Options
There are some options you can change by clicking Options in the toolbar from the Mail Templates component.
The most notable option here is the Mail Format option. This allows you to select if emails are sent using plain text or HTML formatting. The default option is plain text.
If you would like your Emails to look nicer, have styling, colors, etc. you may opt to use HTML templates instead of plain text templates.
If you select HTML here, when you modify a template, you will be presented with your default WYSIWYG HTML editor. This will enable you to style your emails using additional formatting settings.
The next setting is the Per Template Mail Options setting. If enabled, this will add an options tab to each of your mail templates. This allows you to change where each email comes from, individually, per each mail template. For example, if you want your admin related mail templates to come from [email protected] and your user registration emails to come from [email protected], you can enable this and set these options individually. Otherwise, all your emails will come from the default email set in the Global Configuration.
The Send Copy option adds a new field under the options tab of each individual mail template. So if you enable this setting, you can send a copy of each message sent to another specified address on a per-template basis.
The Attachments Folder is the directory of a folder relative to your website’s base directory. For example, if you want to add attachments to your emails from mywebsite.com/emailattachments you would write “emailattachments” in this field. Once defined, you can open any mail template and add file attachments from that folder to the template. Then, whenever the template it sent, the specified attachment will be sent with it. This may be useful if you want to send a welcome PDF or brochure with new user accounts, for example.