Joomla 4 announced Beta 3 version with new features and improved codebase and bug fixes. We assume the stable version of Joomla 4 will be released after the current beta version progresses. it's time to learn how Joomla 4 email configuration works. Joomla 4 email template override offers to add additional custom fields, attachments etc, now it’s possible via Joomla 4 Email templates. Let’s discuss one of the most important features: Joomla 4 email template override.
Email templates in Joomla 4?
Joomla 4 email configuration option introduced from Joomla 4 beta 3 versions, A new com_mail component has been added as a new Joomla 4 feature. The Email component customizes the email templates sent to users for different actions like contact form, registration, Joomla password reset, reminder etc. The core purpose of the Joomla 4 email templates is to allow the admin to customize each email for different subjects and email content based on their website theme. Grace to Joomla Developer to add such a nice Joomla 4 new feature.
Type of Email templates in Joomla 4:
All new Joomla 4 Email options provide full freedom to customize the email templates. Joomla provides multiple mail templates options that we can easily customize to change the Email subject and email body content. There are 5 types of components in Joomla 4 email configuration that can be used to send email notifications :
- Configuration Manager
- System - Joomla! Update Notification
- User - Joomla!
Each component supports a different type of mail templates. A total of 8 types of email templates customization are supported in the current Joomla 4 version. Here is the list:
1. Global Configuration: Test Mail
This Email template is used to customize the email that Admin uses to test whether the email is working or not. This can be tested via Joomla global configurations > Server > Mail > Test Mail.
2. Contacts: Contact Form Mail
If you are using Joomla Contact form to allow the users of the site to submit a contact enquiry, this email template allows you to edit the email template.
3. Contacts: Contact Form Mail Copy
This email template is sent to the submitter of a mail with the contact form only if the optional "Send Copy to Submitter" option is enabled and selected during submitted contact form.
4. Users: Mass Mail Users
Joomla gives the option to send a mass email to site users, you can customize the mass email template using this option.
5. Users: Password Reset
This email template is used when the user requests the password reset option.
6. Users: Username Reminder
This email template is used when a username reminder request is sent, in case the user forgets the username and requires it.
7. Joomla: Update Notification
Joomla used to send the email notification to the site administrator whenever there is a new version of Joomla available, so that site admin can update to the latest Joomla version. You can edit this notification template from Mail templates. This email notification works only if Joomla update notification plugin is enabled.
8. Users: New User
This email notification is sent to the user when the user is created in the backend.
How to customize an Email template:
To use this feature of Joomla you must have the latest version of Joomla 4 installed. Here are the detailed steps to customize an email template. In this example, we will edit the Global Configuration: Test Mail template.
- Login to Joomla 4 Administrator dashboard.
- Navigate to System tab via Left sidebar navigation.
- System settings will show Mail templates options click on it.
- The mail template will show the list of mail 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 in Joomla 4 email templates
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.
Edit an email template with Inbuilt HTML editor is very easy. You can customize any email template with images, professional style, add site logo, footer and many more. HTML Editor has many advantages over the plain editor. Just like in example above we try to override the Joomla user password reset email template and customized it for a professional email with site logo, improved view with different partner site links etc.
You can download the sample email template from here and use the source code in design your website email templates.
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.
More tutorials on Joomla 4: https://www.joomlart.com/blog/joomla-4-tutorials-all-you-need-to-know-about-joomla-4