How to Customize Email Templates in Joomla 4?
- by Naveen Kumar
- on Tutorials
Joomla 4 is around the corner now with its beta version out there for developers & users with many new features, different code structures, some known bug fixes, and other improvements going on at the moment. It is developed and sustained by a global community of volunteers who aim to create new ways for people to manage their content. Joomla 4 offers a platform with a steady, secure, reliable, and a fully upgraded variety of options to design a website.
Joomla already has a lot of amazing features like it has better security options, easy customization of email templates, SEO friendly, frontend editing options just to name a few. Currently, Joomla is in its 3.9 version with which most of us are friendly by now or used to, but Joomla 4 will be very different from its previous versions. It will be different not only in terms of the interface but also in its codebase structure and option customizations.
In this article, we will discuss one such feature of Joomla that are Email templates. Joomla 4 overrides now offer to include additional custom fields, attachments, etc, which was not possible in Joomla 3 versions. Let’s now discuss how email templates work in Joomla 4.
- What are Email templates in Joomla?
- Types of Email Templates
- How to Customize an Email Template
- Testing an Email Template
What are Email templates in Joomla?
Email components are those that customize the email templates sent to users for different actions like contact forms, registration, password reset, etc. In the earlier Joomla versions, we couldn’t modify these email templates for users, the fields & options were fixed. But now thanks to the great team of Joomla developers for adding the com_mails extension using which we can now create and add customized templates each time a mail is sent.
The core purpose of this is to allow the admin to customize each email for different subjects and content based on the theme of their website. This is considered as one of the major feature enhancements in Joomla 4. Though Joomla provides multiple email templates that we can use and customize as per need, there are 5 main components around which this customization works, that are:
- Configuration Manager
- System - Joomla! Update Notifications
- User- Joomla!
Based on these there are only 8 different types of email template customizations possible in Joomla 4 each component having its own type. Now let’s discuss each of these types briefly.
Types of Email Templates
The different types of email templates are as follows:-
Global Configuration: Test Mail:
This template is used to customize the email that the site admin sends to check whether the email functionality is working correctly or not.
Contacts: Contact Form Mail:
This email template customizes the content of Joomla Contact form email, where the users of the website send a contact inquiry mail.
Contacts: Contact Form Mail Copy:
This template is sent to the submitter of the mail with contact form only if “Send a copy to submitter” is checked in the contact form.
Users: Mass Mail Users:
This email template customizes the mass mail content sent to all the users of the website.
Users: Password Reset:
This template customizes the mail when the user sends a password reset request.
Users: Username Reminder:
This template customizes the mail to when a user sends a username reminder request.
Users: New Users:
This customizes the mail when a new user is registered on the website.
Joomla: Update Notification:
This template customizes the mail that Joomla sends to site admin whenever there is a new Joomla update. It only works if the update notification plugin is enabled.
How to Customize an Email Template
To use this feature make sure you have installed the latest version of Joomla 4. Now the steps for customizing are as follows:
Navigate to System Dashboard
Once you have installed Joomla, login to the Admin dashboard and then go to the System dashboard page.
Open the Mail Template Settings
After you open the System page, under Templates you will see the Mail Templates options.
Clicking on it will take you to the list of 8 different types of templates ready for customization.
Open Test Mail Template Settings
Click on the first Global Configuration: Test Mail settings. It has the option for editing the Mail Subject & Mail Body as per requirements. Once you enable these you will also see the available tags that are Sitename & method which can be used dynamically within the email template’s subject or body. Each mail template has its own set of tags for that extra field support.
Change the Mail’s text editor to HTML Editor
By default, every mail template has the Plain text editor, but you can change it to an HTML editor. Go back to the Mail templates list page, on the top right we have the Options > Mail tab > Choose Mail Format as Both or HTML. Again open any of the mail templates and you will either see both the editors or the one you choose.
The HTML editor has more advantages than the regular plain text editor. You can customize any email template with images, professional style, add a site logo, footer, and many more things.
Global Mail Options
On the mail template listing page, go to the Options > Mail tab. Here are some of the other new features added to Joomla 4.
Choose the mail text editor, enable different settings for each email template, use the “send a copy” function, and add the folder path for static mail attachments.
Enabling these options will add an extra tab within each mail template that is the Options tab.
Testing an Email Template
After you have successfully configured the email template in Joomla 4 it's now time to test whether it actually works then how do we see it on our emails.
To test the mail template make sure to configure your email in Joomla Server under Global Configuration > Server > Mail > From email.
Customize Global Configuration: Test Mail Template
I’ll take the example of a Test Mail. Open the Global Configuration: Test mail template, enable edit Subject & edit Body.
Customize the Content
After enabling the edit options, add the subject & body of the email. You can also take the help of the tags where required. And then simply save the template.
After template customization goes to the Global Configurations page under the Server tab and in the end, you will see the Send Test Mail button. Clicking on that button will send a test mail on the same ID configured earlier. The mail received will be in the format of your customized Test Mail template.
This way you can easily customize any mail template now in Joomla 4. This mail template override is one of the most important features of Joomla 4 that has given a wide range of customization support with custom fields, HTML editor, tags in order to create our own template. In conclusion, don’t forget to try out this new feature and let us know if the document was helpful or not.