Guides & TutorialsTroubleshootingEmail TroubleshootingTroubleshooting Email Sending Problems for WHMCS 7.x

Troubleshooting Email Sending Problems for WHMCS 7.x

This article is for WHMCS 7.x.

If emails are not being sent by your WHMCS installation or they are not formatted in the manner expected. Follow these troubleshooting steps

Navigate to Utilities > Logs > Activity Log

Review the logs for any error messages at the time of email sending.

Could not instantiate mail function

This error occurs when are using the PHPMail() Mail Type option is selected.

It means that when attempting to send the email, the server mail rejected it.

The PHP Mail function uses the servers mail() function which is not always reliable, nor does it generate a friendly error. 

Switching to SMTP under Setup > General Settings > Mail tab its faster, safer, provides more descriptive errors when an issue does occur, and is usually more reliable when sending emails.

Alternative server-side configuration changes which might resolve PHP mail() issues:

  • Install a local mail server (e.g. postfix).
  • Ensure that your sendmail_path points at the sendmail binary (usually /usr/sbin/sendmail) in your php.ini. Note that on Ubuntu/Debian you may have multiple .ini files in /etc/php5/mods-available and possibly other locations.
Could not connect to SMTP host

There are several possible reasons for this error:

  • The SMTP settings entered under Setup > General Settings > Mail tab are incorrect. Please check with your system administrator that you have entered the correct SMTP host, port, username, password and selected the appropriate SSL Type for use with your mail server.
  • An inappropriate SMTP port has been specified for use with the SSL Type option selected. For example, selecting SSL and the port number 25 would cause this error:

The SMTP port value 25 (point 1) is not compatible with the SSL Type value SSL (point 2).

The most common port assignments by SSL type are:

SSL Type Port Number
25 or 26
SSL 465 or 587
TLS 587
  • The mail server is blocking connections from the server upon which WHMCS is installed.
  • The server on which WHMCS is installed is blocking outgoing connections to the mail server.

Please work with your server admin/hosting provider to resolve these two points.

Could Not Authenticate

This indicates that the SMTP details stored at Setup > General Settings > Mail tab are being rejected by the mail server. Ensure that they are correct.

Something to watch out for is SMTP Restrictions in cPanel/WHM. SMTP Restrictions will automatically re-route any SMTP traffic leaving the server back to localhost (the server WHMCS is on). The fix is simple, in WHM (Home >> Security Center >> SMTP Restrictions) make sure this option is disabled.

If using Google Mail this could also be caused by the security settings in your email account. Please refer to these Google Mail troubleshooting resources:

Sender Verify Failed

A Sender Verify Failed error indicates that the email address being used to send does not exist on the SMTP server.

To confirm this, login to cPanel and select the Email Accounts page:

Take a note of the email accounts which are configured on the Email Accounts page:

In WHMCS, navigate to Setup > General Settings

Verify that the Email Address value here matches one of the emails from cPanel

Syntax Error

A syntax error is caused by invalid code in the email template which is being sent.

The error in the Utilities > Logs > Activity Log provides debugging information:

  1. The error,
  2. Line number of the invalid syntax within the email template,
  3. The code surrounding the error.

To resolve the error. navigate to Setup > Email Templates and click on the email template which is experiencing the error. In this example it's the Client Signup Email

Review the code of the email template and correct any errors.

In this example, an erroneous {if} has been left in the email template. Removing it will correct the syntax.

Click Save Changes.

Smarty Error: Not allowed by security policy

A Smarty Security Policy Error means that the email template being sent contains advanced code which is blocked by the default email security policy.

You should first review the code in the email being sent to confirm you are happy with what is to be sent. This is done via the Setup > Email Templates page.

You can then add an exception to the email security policy to allow the particular piece of code in use.

A more detailed explanation of the security policy and instructions for adding an exception are located on the Smarty Security Policy page of our documentation.