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:
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.
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.
To do this in phpMyAdmin:
- Select the WHMCS database.
- Click on the
tblemailtemplates
database name. - Select Operations.
- Rename the database to use
tblemailtemplates_backup
as the table name. - 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:
- Download a new copy of the full release files for your version of WHMCS from the WHMCS Downloads page or from your reseller.
- Extract the contents of the downloaded
.zip
file. - Find the two
.sql
files to restore the default email templates in the/whmcs/resources/sql/install/
folder:tblemailtemplates.schema.sql
tblemailtemplates.data.sql
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:
- Select the WHMCS database.
- Select Import.
- Click Browse and choose the
tblemailtemplates.schema.sql
file. - 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:
- Select the WHMCS database.
- Click the
tblemailtemplates
table. The table will be empty. - Select Import.
- Click Choose File.
- Select the
tblemailtemplates.data.sql
file. - Click GO. When the import succeeds, the system will display a Import has successfully finished message.
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.
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: November 19, 2024