Customize Email Templates in Joomla 4
From Joomla 4, a new com_mail component has been added as a new feature of the platform. The Email component customizes the email templates sent to the users for different actions like contact form, signup, Joomla password reset, reminder, etc.
In this article, let's discuss how email templates work in Joomla 4.
Type of Email templates
All new Joomla 4 Email options offer full freedom to customize email templates. Joomla provides many email template options that we can easily customize to change Email subject and email content. There are 5 types of components in the Joomla 4 email configuration that can be used to send email notifications:
- Configuration management
- System - Joomla! Update notice
- User - Joomla!
Customize the Email template
To use this Joomla feature, you must have the latest Joomla 4 version installed. Below are the detailed steps to customize an email template. In this example, we will edit the Global Configuration: Test Mail template.
- Log in to the Joomla 4 Admin dashboard.
- Navigate to the System tab via the Navigation bar on the left.
- System settings will show Mail template options click it.
- The message template will display a list of message templates that can be customized.
- Open global configuration: Test mail
Once you click on the Test Mail, It will show the option to edit the Mail template for English. Edit Mail template screen will give us the following options:
Edit Subject: Email Subject refers to the subject of the Email.
Edit Body: Email body contains the text you will see in your email.
You can change the default Subject or the email and body content as per requirements. Email templates also support extra files. As you can see in the Test mail template Sitename and Method fields present that can be used inside the subject or body. Each Mail template has a different type of extra fields support.
Enable HTML Editor
By default, Joomla mail templates will show the plan format, but it’s not End. Joomla 4 comes with HTML editor support and also offers attachments in email. Using an HTML Editor instead of plain editor gives you more advanced options and user-friendly view. You can restyle the text with help of inbuilt Joomla editor (default site editor) for different color, heading, font style and many more options to make a beautiful email template. You can enable these options via the Global setting of mail templates. Here are the steps:
Navigate to System > Mail templates > Options
Change Mail format to HTML (both in case you want to see plan format as well)
Save the settings and open any Mail template to see the editor.
Joomla 4 email template override also offers some important options that give more freedom to site administrators for email customizations. In global options for Mail settings, some new settings can be used to apply different settings for each email template
Mail Format: Mail format option is used to change the Mail body Editor (plan/HTML).
Per template settings: Per template settings means you have the option to apply different settings for each template. Once this option is turned On, You can see a new Tab in Options when you Edit Mail template. ( Enable this option if you want different settings for each email template )
Send Copy: This option allows you to send a copy of the email to the email that will be added in Mail template options (If enabled a new option will be visible as Send a copy to email).
Attachment Folder: a relative path to the root of your installation for the folder with static attachments that you want to attach to the mails (Once enabled a new option will be shown in the Edit mail template tab to attach a file).
Joomla 4 email template override is an important new feature of Joomla 4 that gives a wide range of customization support with custom fields and HTML editor to design own email template. The HTML editor support and special customization for each new template will be something that is going to be a hit. We will look for more new features and updates for Joomla 4 and come back with a new Joomla 4 tutorial.