Knowledgebase

How to edit the email templates in Drupal

Drupal comes preconfigured with some default email templates. These templates are used when Drupal sends emails automatically for specific reasons. Most of the templates are for different account related actions. For example, when a user registers but admin approval is required, Drupal will automatically send an email to the user that the account is awaiting approval. There's a preconfigured email template for that occasion and its text will be used.

To edit the email templates, log in to the admin panel of your Drupal, click on the Configuration tab in the top navigation bar, and on the page that opens click on Account settings. On the following page scroll down to the last section; it's labeled E-mails. On the left side in that section there are some buttons. Each one corresponds to an email template: e.g. Account activation, Account blocked, Account canceled, etc. When you click on one of these buttons you'll see on the right side the subject and the body of the template corresponding to the button.

The subject and the body consist of plain text and some variables. These variables have the form of [user:name], [site:name], [site:url], etc. You can see the available variables listed just above the subject of the email template. When an email message is sent to a user the variable is replaced with the necessary information. For example, [user:name] is replaced with the actual username of the particular user; [site:url] is replaced with the URL address of your site, etc.

You can edit the text of any of these preconfigured email templates, and you can also edit, delete or add variables in the text. Some of these email templates are actually not sent automatically when the particular action is performed. For example, there's a template called Account blocked, but when a user account is blocked the message will not be sent automatically. To change this, click on the button for the template and on the right you'll see a checkbox labeled Notify user when account is blocked (in the case with the Account blocked template). Just mark the checkbox and save the changes.

Another example of a template that is not automatically sent is Account canceled. Most of the other email templates are sent automatically and there's no option to disable the automatic sending (e.g. the Welcome templates, Password recovery). An exception is the Account activation template which is sent automatically after a visitor registers and the account is approved by an administrator; the automatic sending of this email message, however, can be disabled by unmarking the respective checkbox.

Don't forget to click on the Save configuration button at the bottom of the page when you're done with the changes.

Was this answer helpful?

 Print this Article

Also Read