Restore Default Email Templates

You can restore your WHMCS installation’s email templates to their default contents using a backup database table.

You may want to do this if, for example, a syntax error occurs or you accidentally delete a template and see an Email Template Not Found error:

An Email Sending Failed error in the Client Profile

WHMCS stores all of the available email templates in the tblemailtemplates database table. You can check for the presence of individual email templates in the Admin Area at Configuration () > System Settings > Email Templates.

Make certain to create a backup of your WHMCS installation’s database before you perform the steps below.

Restore an Email Template

To restore the default version of an email template:

1. Rename the current database table.

To create a backup copy of the database, rename the current database table.

Perform the steps below using either phpMyAdmin or SQL statements. Do not use both sets of steps together.

To do this in phpMyAdmin:

  1. Select the WHMCS database.
  2. Click on the tblemailtemplates database name.
  3. Select Operations.
  4. Rename the database to use tblemailtemplates_backup as the table name.
  5. Click GO.

To do this in MySQL directly, run the following SQL statement:

RENAME TABLE `tblemailtemplates` TO `tblemailtemplates_backup`;

2. Download the default email template files.

To get the necessary files:

  1. Download a new copy of the full release files for your version of WHMCS from the WHMCS Downloads page or from your reseller.
  2. Extract the contents of the downloaded .zip file.
  3. Find the two .sql files to restore the default email templates in the /whmcs/resources/sql/install/ folder:
    • tblemailtemplates.schema.sql
    • tblemailtemplates.data.sql
      Database files in the full release folder

3. Import the email template schema file.

To create the new database table for email templates, you must first import the schema file (tblemailtemplates.schema.sql ).

To do this in phpMyAdmin:

  1. Select the WHMCS database.
  2. Select Import.
    Importing files in phpMyAdmin
  3. Click Browse and choose the tblemailtemplates.schema.sql file.
  4. Click GO.

4. Import the email template data file.

Importing the email template data file (tblemailtemplates.data.sql) will restore all of the default email templates to the database table.

To do this in phpMyAdmin:

  1. Select the WHMCS database.
  2. Click the tblemailtemplates table. The table will be empty.
  3. Select Import.
    Importing files in phpMyAdmin
  4. Click Choose File.
  5. Select the tblemailtemplates.data.sql file.
  6. Click GO. When the import succeeds, the system will display a Import has successfully finished message.
    Importing files in phpMyAdmin

5. Restore any custom email templates.

If you use any custom email templates, you must import them separately.

To do this, access those email templates in the tblemailtemplates_backup table that you created in Step 1. Add the templates manually in the Admin Area at Configuration () > System Settings > Email Templates.

Email Templates in the Admin Area

6. Verify the email template files.

When you have imported all of the necessary files, check the email templates at Configuration () > System Settings > Email Templates.

  • Ensure that any missing email templates now appear in the list and have the correct contents.
  • Ensure that any email templates with syntax errors now have the default contents.

Last modified: June 14, 2024