Introduction: Configuring a New Drupal 8 Website.
This Tutorial will show Drupal administrators how to customize the “Welcome” email text that is sent out to registered users via email during the sign-up process.
- Problem: When new users register, they receive a welcome email that needs more information about business services, website policies, & account management.
- Solution: Navigate to Drupal 8 Administration & re-write the email text for new users with system PHP & MySQL database variables. Save the new settings.
With this solution, business owners can include more information about their services in emails and websites can customize their welcome message to new users. Let’s get started.
Step One: Confirm User Management & Role Settings.
In the first step, we will confirm the Role settings on a new Drupal 8 website by navigating to: /admin/people and then clicking on the Roles tab.
The default Drupal 8 configuration is for three roles: Anonymous User, Authenticated User, & Administrator.
This tutorial will review the settings for creating a custom email for the Authenticated User role.
After a new user registers, he/she will receive a welcome email from the website with a signed message from the business or publishers.
Businesses need to edit this information in order to include more pertinent details on account management and specific links to website policies.
Welcome emails can also promote ecommerce listings and different products. Administrators can build templates with HTML & system PHP variables.
Step Two: Review the Welcome Email Configuration.
Review the Site Details settings at: /admin/config/system/site-information
Make sure to change your Site Name to how it will appear in the welcome emails.
Next navigate to /admin/config/people/accounts to review the Registration & Cancellation settings for the Drupal 8 website.
Change the settings to permit Visitors to register without administrator approval.
In the Email section:
Change the email title and text according to the requirements of the website.
[user:display-name], A site administrator at [site:name] has created an account for you. You may now log in by clicking this link or copying and pasting it into your browser: [user:one-time-login-url] This link can only be used once to log in and will lead you to a page where you can set your password. After setting your password, you will be able tologinat [site:login-url] in the future using: username: [user:name] password: Your password -- [site:name] team
For new users, the email text will be different depending on whether the account needs to have administrator approval or not. Administrators can also change the account activation email text:
[user:display-name], Your account at [site:name] has been activated. You may now log in by clicking this link or copying and pasting it into your browser: [user:one-time-login-url] This link can only be used once to log in and will lead you to a page where you can set your password. After setting your password, you will be able tologinat [site:login-url] in the future using: username: [user:account-name] password: Your password
Note: Drupal 8 has options for using available system PHP variables available through Tokens.
Step Three: Add System PHP Variables to Email Text.
The available system PHP Variables available for the email text settings are:
[site:name], [site:url], [user:display-name], [user:account-name], [user:mail], [site:login-url], [site:url-brief], [user:edit-url], [user:one-time-login-url], [user:cancel-url]
These may vary & increase depending on what other modules are installed in your Drupal 8 CMS locally. Include the PHP variable tokens for referencing Drupal 8 user information.
Step Four (Optional): Add HTML Mail Support.
To give even more options in customizing the welcome emails in Drupal 8, administrators can install the HTML Mail module
Prerequisites: In order to install HTML Mail module, first you will need to install the Mail System & Pathologic modules.
After enabling these modules in Drupal 8, install & enable the HTML Mail module.
Hint: Drupal web developers can use the Token module to have access to more PHP variables from other modules in emails.
Echo wraps your messages in a Drupal theme so that you can send branded HTML5 emails with the same logo, header, fonts, & styles as your website.
Conclusion: HTML Mail & Token for Advanced Features.
The HTML Mail module gives Drupal 8 site administrators the options to create custom welcome email templates for users with site information, account management links, & ecommerce promotions.
Summary: Use Token for even more access to PHP variables from Drupal 8 modules.
Topics:Drupal 8, User Management, Email, CRM, Web Security
Check out these top 3 Drupal hosting services: