Difference between revisions of "Email Sending Issues"

From WHMCS Documentation

m (General Emails)
 
(17 intermediate revisions by 5 users not shown)
Line 1: Line 1:
There may be occasions where emails are not being sent as expected by the system. The problem is usually a misconfiguration, this page explains the symptoms, causes and resolutions to the most common email sending problems.
+
Sometimes, the system may not send mail using the expected methods. The problem is usually a misconfiguration.
  
 
==Emails Not Sending==
 
==Emails Not Sending==
 +
 
===General Emails===
 
===General Emails===
If general emails are not being sent (such as client sign-up confirmation, order confirmation etc.) you can take the following steps to ensure it is setup properly for the emails to be sent out.
+
 
 +
If the system isn't sending general emails, such as client sign-up or order confirmations, take the following steps to ensure a correct setup.
  
 
First, check these points:
 
First, check these points:
#Ensure the email template is not disabled under Setup > Email Templates.
 
#There are no custom action hooks in the /includes/hooks and /modules/addons directories that could be preventing email sending.
 
#Can the email be sent manually?
 
  
If the issue is still not resolved:
+
#Check whether you have disabled the email template in '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > [[Email Templates]]''' or, prior to WHMCS 8.0, '''Setup > Email Templates'''.
#Do you see the email in the Utilities > Logs > Email Message Log page?
+
#Check whether custom action hooks that could prevent email from sending exist in the <tt>/includes/hooks</tt> and <tt>/modules/addons</tt> directories.
#Is there an error at the time of email sending under Utilities > Logs > [[Activity_Logs|Activity Log]]?
+
#Check whether you can send the emails manually.
 +
 
 +
If the above steps don't resolve the issue:
 +
 
 +
#Check whether any email appears in the '''Email Message Log''' at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > [[System Logs]]''' ('''Utilities > Logs''' in WHMCS 7.x and earlier).
 +
#Check whether an error occurs at the time of email sending in the '''Activity Log''' at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > [[System Logs]]''' ('''Utilities > Logs''' in WHMCS 7.x and earlier).
  
 
'''No Error in Activity Log:'''<br/>
 
'''No Error in Activity Log:'''<br/>
If a message is recorded in the Email Message Log and there's no error in the Activity Log we can conclude it left WHMCS without any errors from your mail server. Therefore the problem is one of email delivery and not a WHMCS software issue. Please contact your mail server administrator to investigate.
 
  
<div class="docs-alert-warning"><i class="fa fa-question-circle"></i> In WHMCS version 7.6 and above, the Automated Password Reset and Client Email Address Verification email templates are not recorded in the Email Message Log to protect the sensitive data they contain.</div>
+
If a message exists in the '''Email Message Log''' and there are no errors in the '''Activity Log''', the message likely left WHMCS without any errors from your mail server. Therefore, the problem is one of email delivery and not a WHMCS software issue. Contact your mail server administrator to investigate.
 +
 
 +
There are many email templates for which the '''Email Message Log''' doesn't record messages, in order to protect the sensitive data they contain. These are:
 +
 
 +
* Automated Password Reset.
 +
* Client Email Address Verification.
 +
* Password Reset Validation.
 +
 
 +
In addition to this, there a number of email templates for which the system won't CC or BCC at the template level. These are:
 +
 
 +
* Password Reset Validation.
 +
* Password Reset Confirmation.
 +
* Automated Password Reset.
  
 
===Product Welcome Email===
 
===Product Welcome Email===
Problems with the sending of the welcome email are typically related an issue with the creation of the account. As such please refer to [[Auto Setup Issues]] to troubleshoot.
 
  
 +
Problems sending welcome emails typically relate to [[Auto Setup Issues|an account creation issue]]. The system sends the welcome email when the module's '''Create''' command completes successfully and automatically, creating the account on the server. Unsent welcome emails indicate a problem with the automated setup not occurring.
 +
 +
To troubleshoot this problem, perform these steps in the following order:
 +
# First, perform the troubleshooting steps in [[Auto Setup Issues]].
 +
# Check whether you selected a welcome email for the product at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > [[Products and Services|Products/Services]]''' or, prior to WHMCS 8.0, '''Setup > Products/Services > Products/Services'''.
 +
# Check the activity log for any syntax errors in the email template.
 +
 +
If you aren't using a module (for example, cPanel or Plesk), you can send the welcome email automatically by selecting the [[Auto_Release|Autorelease module]].
  
 
===Support Ticket Notifications===
 
===Support Ticket Notifications===
If support ticket notification emails are not being sent to staff (such as new support tickets, new client reply etc.) you can take the following steps to ensure it is setup properly for the notifications to be sent out.
 
  
First, check these 3 things:
+
If the system isn't sending support ticket notification emails to your staff (for example, new support tickets or new client replies) take the following steps to ensure it is set up properly:
#Please ensure the 'Enable Ticket Notifications' options are ticked under Setup > Staff Management > Administrator Users > Edit
+
 
#The "Support Emails' option should also be ticked under Setup > Staff Management > Administrator Roles > Edit
+
First, check these points:
#Finally, ensure the admin ticket notification emails are not disabled under Setup > Email Templates.
 
  
If the issue is still not resolved:
+
# Check whether you have selected '''Enable Ticket Notifications''' at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > Manage Admins > [[Administrator Users]]''' or, prior to WHMCS 8.0, '''Setup > Staff Management > Administrator Users'''.
#Ensure the Setup > General Settings > Support tab > Disable Reply Email Logging option is UNticked and reproduce the issue.
+
# Check whether you have selected '''Support Emails''' under '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > Manage Admins > [[Administrator Roles]]''' or, prior to WHMCS 8.0, '''Setup > Staff Management > Administrator Roles'''.
#Is there an error at the time of email sending under Utilities > Logs > Activity Log?
+
#Check whether the admin ticket notification emails are disabled under '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > [[Email Templates]]''' or, prior to WHMCS 8.0, '''Setup > Email Templates'''.
 +
 
 +
If the above steps don't resolve the issue:
 +
 
 +
# Check whether you have selected '''Disable Reply Email Logging''' in the '''[[Support Tab|Support]]''' tab at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > General Settings''' or, prior to WHMCS 8.0, '''Setup > General Settings'''. If you have selected it, deselect it and then attempt to replicate the issue.
 +
# Check whether there's an error at the time of email sending under '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > [[System Logs]]''' ('''Utilities > Logs''' in WHMCS 7.x and earlier).
  
 
'''No Error in Activity Log:'''
 
'''No Error in Activity Log:'''
If there is no error in the Activity Log at the time of email sending we can conclude it left WHMCS without any errors from your mail server. Therefore the problem is one of email delivery and not a WHMCS software issue. Please contact your mail server administrator to investigate.
 
  
 +
If there is no error in the '''Activity Log''' at the time of email sending, this indicates that the email left WHMCS without any errors from your mail server. Therefore, the problem is one of email delivery and not a WHMCS software issue. Contact your mail server administrator to investigate.
  
 
==Emails Flagged as Spam==
 
==Emails Flagged as Spam==
There are multiple reasons why emails sent by a WHMCS installation may be sent to a spam folder or rejected, most relating to server configuration. WHMCS Email templates in themselves should not trigger any standard spam rules. Here are some points to check:
+
 
 +
There are multiple reasons why systems may deliver emails from a WHMCS installation to a spam folder or reject them. Usually, this is due to the server configuration. WHMCS email templates should not trigger any standard spam rules.  
 +
 
 +
First, check these points:
 
   
 
   
* Try using SMTP rather than PHP Mail under Setup > General Settings > Mail Tab. Many email providers block PHP mailer scripts as "unverified mail".  
+
* Check whether you can use SMTP rather than PHP mail in the '''[[Mail Tab|Mail]]''' tab at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > General Settings''' or, prior to WHMCS 8.0, '''Setup > General Settings'''. Many email providers block PHP mailer scripts as "unverified mail".  
 
   
 
   
* Verify the email address you are sending "from" has actually been created on your server, and can send/receive mail normally.  
+
* Verify that the email address you are sending "from" actually exists on your server, and whether it can send and receive mail normally.  
 
   
 
   
* Check your mail servers IP to verify it is not listed in any black lists at http://mxtoolbox.com
+
* Check your mail server's IP address to verify it is not in any blacklists at http://mxtoolbox.com.
 
   
 
   
 
* Contact your web hosting or mail server provider for investigation into your IP reputation. They will be able to contact other email providers on your behalf.  
 
* Contact your web hosting or mail server provider for investigation into your IP reputation. They will be able to contact other email providers on your behalf.  
 
   
 
   
* If it is suspected that the wording of an email being sent by WHMCS may be triggering a filter, try customizing you email templates so they do not appear exactly like every other WHMCS installations emails.  
+
* If you suspect that the wording of an email may be triggering a filter, try customizing you email templates so they do not match every other WHMCS installation's emails.  
 
   
 
   
* Verify your domain has an accurate and strict SPF record setup, as well as a correct PTR record.
+
* Verify that your domain has an accurate and strict SPF record setup, as well as a correct PTR record.
 
 
  
 
==Troubleshooting==
 
==Troubleshooting==
 
   
 
   
Sometimes the error output in the Activity Log when sending of emails via SMTP fails can lack verbosity or the underlying cause may be different from the message that is ultimately displayed. Adding the following line to the configuration.php file will output a lot of debugging information when a mail is being sent manually, provided the Setup > General Settings > Mail tab > Mail Type is '''SMTP''':
+
Sometimes, the error output in the '''Activity Log''' at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > [[System Logs]]''' ('''Utilities > Logs''' in WHMCS 7.x and earlier) when sending of emails via SMTP fails can lack verbosity. Alternatively, the underlying cause may be different from the message that the system ultimately displays. Adding the following line to the <tt>configuration.php</tt> file will output a lot of debugging information when you send mail manually. This requires that the '''Mail Type''' setting in the '''[[Mail Tab|Mail]]''' tab at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > General Settings''' is '''SMTP''':
 
   
 
   
 
<source lang="php">$smtp_debug = true;</source>
 
<source lang="php">$smtp_debug = true;</source>
 
   
 
   
After sending an email manually, the interaction between your server and the email server will be displayed on-screen for debugging purposes. Once finished, be sure to revert the change to the configuration.php file.
+
After sending an email manually, the system will display the interaction between your server and the email server, for debugging purposes. After this process, be sure to revert the change to the <tt>configuration.php</tt> file.
  
 
===Common Errors===
 
===Common Errors===
 +
 
The following are errors which may commonly appear in the activity log when attempting to send an email, resulting in email sending failure.
 
The following are errors which may commonly appear in the activity log when attempting to send an email, resulting in email sending failure.
  
 
====Could not connect to SMTP host====
 
====Could not connect to SMTP host====
 +
 
There are several possible reasons for this error:
 
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.
+
 
#The mail server is blocking connections from the server upon which WHMCS is installed.
+
# The SMTP settings in the '''[[Mail Tab|Mail]]''' tab at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > General Settings''' are incorrect. Check with your system administrator to verify that you have entered the correct SMTP host, port, username, and password, and that you have selected the appropriate SSL type for use with your mail server.
#The server on which WHMCS is installed is blocking outgoing connections to the mail server.
+
#The mail server is blocking connections from your WHMCS installation's server.
#An inappropriate SMTP port has been specified for use with the SSL Type option selected. For example, selecting TLS and the port number 256 would cause this error. The most common port assignments are [http://docs.whmcs.com/Mail_Tab#SMTP_Port listed on this page].
+
#Your WHMCS installation's server is blocking outgoing connections to the mail server.
#The mail server is advertising TLS connections are available, but when a secure connection is attempted it fails due to a certificate validation error. The appropriate solution would be to ensure a validated certificate is installed on the mail server. As a workaround the '''SMTPAutoTLS''' setting can be set to ''false'' in ''/vendor/phpmailer/phpmailer/class.phpmailer.php''. More information: https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting#opportunistic-tls
+
#The system is using an inappropriate SMTP port and the '''SSL Type''' option is selected. For example, selecting TLS and the port number 256 would cause this error. For a list of the most common port assignments, see [[Mail Tab]].
 +
#The mail server is advertising that TLS connections are available, but when a secure connection is attempted it fails due to a certificate validation error. The appropriate solution would be to ensure that you have installed a validated certificate on the mail server. As a workaround, you can set the '''SMTPAutoTLS''' setting to ''false'' in ''/vendor/phpmailer/phpmailer/class.phpmailer.php''. For more information, see [https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting#opportunistic-tls the PHPMailer troubleshooting documentation].
  
 
====Message body empty====
 
====Message body empty====
A "Message Body Empty" error indicates that a syntax error occurred preventing the email from sending. Review '''Utilities > Logs > Activity Log''' at the time of sending for entries beginning "Smarty Error". This will provide more information on the invalid syntax which will need to be corrected before attempting to send the email again.
+
 
 +
A "Message Body Empty" error indicates that a syntax error occurred, preventing the email from sending. Review '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > [[System Logs]]''' ('''Utilities > Logs > Activity Log''' in WHMCS 7.x and earlier) at the time of sending for entries beginning "Smarty Error". This will provide more information on the invalid syntax, which you will need to correct before attempting to send the email again.
  
 
====The following recipients failed====
 
====The following recipients failed====
This error is often caused by a misaddressed email. Check the following locations to ensure a valid email address is entered:
+
 
*The client's Profile tab
+
This error is often due to a misaddressed email. Check the following locations to ensure a valid email address:
*The client's Contacts tab
+
 
*Setup > General Settings > Mail tab > BCC Messages field
+
*The client's '''[[Clients:Profile Tab|Profile]]''' tab.
*Setup > Email Templates > Edit > Copy To field
+
*The client's '''[[Clients:Contacts Tab|Contacts]]''' tab.
*All administrator users under Setup > Staff Management > Administrator Users
+
*'''BCC Messages''' in the '''[[Mail Tab|Mail]]''' tab at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > General Settings''' or, prior to WHMCS 8.0, '''Setup > General Settings'''.
 +
*'''Copy To''' when you edit a template at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > [[Email Templates]]''' or, prior to WHMCS 8.0, '''Setup > Email Templates'''.
 +
*All administrator users at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > Manage Admins > [[Administrator Users]]''' or, prior to WHMCS 8.0, '''Setup > Staff Management > Administrator Users'''.
 +
 
 
Check for blank spaces or punctuation before or after an email address in all the above locations.
 
Check for blank spaces or punctuation before or after an email address in all the above locations.
  
 +
====Email Send Aborted By Hook====
 +
 +
An "Email Send Aborted By Hook" error indicates that a custom hook has prevented the email from sending.
 +
 +
Take the following actions to begin troubleshooting this error:
 +
 +
* Enable the [[Other_Tab#Hooks_Debug_Mode|Hooks Debug Mode]] option.
 +
* Replicate the error again.
 +
* Disable the Hooks Debug Mode option.
 +
* Review the [[System Logs|Activity Log]].
 +
* Locate the "Email Send Aborted By Hook" error in the log.
 +
 +
After locating the error look over the adjacent entries for a series of three lines that look similar to the following:
 +
 +
<source>
 +
Hooks Debug: Hook File Loaded: /path/to/the/hook_file.php
 +
Hooks Debug: Hook Defined for Point: EmailPreSend - Priority: 1 - Function Name: (anonymous function)
 +
Hooks Debug: Attempting to load hook file: /path/to/the/hook_file.php
 +
</source>
 +
 +
The file in the "Hook File Loaded" and "Attempting to load hook file" entries is the hook responsible for the "Email Send Aborted By Hook" error.
 +
 +
Contact the developer of that hook file for more information.
 +
 +
====Email sending aborted.====
 +
 +
An "Email sending aborted." error indicates that an unknown issue has prevented the email from sending.
 +
 +
This error commonly occurs when there is a configuration issue with the file paths in the [[Storage_Settings|Storage Settings]] section of the installation.
 +
 +
To remedy this, ensure that you have updated the storage locations. For more information, see the [[Moving_Storage_Locations|Moving Storage Locations]] guide.
 +
 +
====Email sending aborted by configuration====
 +
 +
In WHMCS 8.1, this error indicates that you have set '''Disable Email Sending''' to '''ON''' at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > General Settings''' in the '''[[Mail Tab|Mail]]''' tab. The system creates a log entry each time that you enable or disable this setting. For more information, see [[Disabling Outgoing Mail]].
 +
 +
We recommend that you only enable this setting when you are testing updates or customizations on a development installation or while troubleshooting.
  
 
{{troubleshooting}}
 
{{troubleshooting}}
 +
 +
==Emails Flagged as Spam==
 +
 +
There are multiple reasons why systems may deliver emails from a WHMCS installation to a spam folder or reject them. Usually, this is due to the server configuration. WHMCS email templates should not trigger any standard spam rules.
 +
 +
First, check these points:
 +
 +
* If you use '''PHP Mail''', check whether you can use a different '''Mail Provider''' in the '''[[Mail Tab|Mail]]''' tab at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > General Settings'''. Many email providers block PHP mailer scripts as "unverified mail".
 +
 +
* Verify that the email address you are sending <tt>from</tt> actually exists on your server, and whether it can send and receive mail normally.
 +
 +
* Check your mail server's IP address to verify that it's not in any blacklists at [http://mxtoolbox.com the mxtoolbox website].
 +
 +
* Contact your web hosting or mail server provider for investigation into your IP reputation. They will be able to contact other email providers on your behalf.
 +
 +
* If you suspect that the wording of an email may be triggering a filter, try customizing you email templates so they do not match every other WHMCS installation's emails.
 +
 +
* Verify that your domain has an accurate and strict SPF record setup, as well as a correct PTR record.
 +
 +
==Troubleshooting==
 +
 
 +
Sometimes, the '''Activity Log''' error output lacks verbosity when sending emails via SMTP fails. Alternatively, the underlying cause may be different from the message that the system ultimately displays.
 +
 +
===For version 8.0 and later===
 +
 +
In WHMCS 8.0 and later, follow these steps if your Mail Provider is SMTP:
 +
 +
# Go to '''Configuration > System Settings > General Settings''' and select the '''[[Mail Tab|Mail]]''' tab.
 +
# Click '''Configure Mail Provider'''.
 +
# Check '''SMTP Debug'''.
 +
# Click '''Test Configuration'''.
 +
# View the debugging output at '''Configuration > [[System Logs]]'''.
 +
 +
===For version 7.x and earlier===
 +
 +
In WHMCS 7 and earlier, adding the following line to the <tt>configuration.php</tt> file will output a large amount of debugging information when you send mail manually. This requires that the '''Mail Type''' is ''SMTP'' in the '''[[Mail Tab|Mail]]''' tab at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > General Settings''':
 +
 +
<source lang="php">$smtp_debug = true;</source>
 +
 
 +
After sending an email manually, the system will display the interaction between your server and the email server, for debugging purposes. After this process, be sure to revert the change to the <tt>configuration.php</tt> file.

Latest revision as of 20:08, 11 May 2022

Sometimes, the system may not send mail using the expected methods. The problem is usually a misconfiguration.

Emails Not Sending

General Emails

If the system isn't sending general emails, such as client sign-up or order confirmations, take the following steps to ensure a correct setup.

First, check these points:

  1. Check whether you have disabled the email template in Configuration () > System Settings > Email Templates or, prior to WHMCS 8.0, Setup > Email Templates.
  2. Check whether custom action hooks that could prevent email from sending exist in the /includes/hooks and /modules/addons directories.
  3. Check whether you can send the emails manually.

If the above steps don't resolve the issue:

  1. Check whether any email appears in the Email Message Log at Configuration () > System Logs (Utilities > Logs in WHMCS 7.x and earlier).
  2. Check whether an error occurs at the time of email sending in the Activity Log at Configuration () > System Logs (Utilities > Logs in WHMCS 7.x and earlier).

No Error in Activity Log:

If a message exists in the Email Message Log and there are no errors in the Activity Log, the message likely left WHMCS without any errors from your mail server. Therefore, the problem is one of email delivery and not a WHMCS software issue. Contact your mail server administrator to investigate.

There are many email templates for which the Email Message Log doesn't record messages, in order to protect the sensitive data they contain. These are:

  • Automated Password Reset.
  • Client Email Address Verification.
  • Password Reset Validation.

In addition to this, there a number of email templates for which the system won't CC or BCC at the template level. These are:

  • Password Reset Validation.
  • Password Reset Confirmation.
  • Automated Password Reset.

Product Welcome Email

Problems sending welcome emails typically relate to an account creation issue. The system sends the welcome email when the module's Create command completes successfully and automatically, creating the account on the server. Unsent welcome emails indicate a problem with the automated setup not occurring.

To troubleshoot this problem, perform these steps in the following order:

  1. First, perform the troubleshooting steps in Auto Setup Issues.
  2. Check whether you selected a welcome email for the product at Configuration () > System Settings > Products/Services or, prior to WHMCS 8.0, Setup > Products/Services > Products/Services.
  3. Check the activity log for any syntax errors in the email template.

If you aren't using a module (for example, cPanel or Plesk), you can send the welcome email automatically by selecting the Autorelease module.

Support Ticket Notifications

If the system isn't sending support ticket notification emails to your staff (for example, new support tickets or new client replies) take the following steps to ensure it is set up properly:

First, check these points:

  1. Check whether you have selected Enable Ticket Notifications at Configuration () > Manage Admins > Administrator Users or, prior to WHMCS 8.0, Setup > Staff Management > Administrator Users.
  2. Check whether you have selected Support Emails under Configuration () > Manage Admins > Administrator Roles or, prior to WHMCS 8.0, Setup > Staff Management > Administrator Roles.
  3. Check whether the admin ticket notification emails are disabled under Configuration () > System Settings > Email Templates or, prior to WHMCS 8.0, Setup > Email Templates.

If the above steps don't resolve the issue:

  1. Check whether you have selected Disable Reply Email Logging in the Support tab at Configuration () > System Settings > General Settings or, prior to WHMCS 8.0, Setup > General Settings. If you have selected it, deselect it and then attempt to replicate the issue.
  2. Check whether there's an error at the time of email sending under Configuration () > System Logs (Utilities > Logs in WHMCS 7.x and earlier).

No Error in Activity Log:

If there is no error in the Activity Log at the time of email sending, this indicates that the email left WHMCS without any errors from your mail server. Therefore, the problem is one of email delivery and not a WHMCS software issue. Contact your mail server administrator to investigate.

Emails Flagged as Spam

There are multiple reasons why systems may deliver emails from a WHMCS installation to a spam folder or reject them. Usually, this is due to the server configuration. WHMCS email templates should not trigger any standard spam rules.

First, check these points:

  • Check whether you can use SMTP rather than PHP mail in the Mail tab at Configuration () > System Settings > General Settings or, prior to WHMCS 8.0, Setup > General Settings. Many email providers block PHP mailer scripts as "unverified mail".
  • Verify that the email address you are sending "from" actually exists on your server, and whether it can send and receive mail normally.
  • Contact your web hosting or mail server provider for investigation into your IP reputation. They will be able to contact other email providers on your behalf.
  • If you suspect that the wording of an email may be triggering a filter, try customizing you email templates so they do not match every other WHMCS installation's emails.
  • Verify that your domain has an accurate and strict SPF record setup, as well as a correct PTR record.

Troubleshooting

Sometimes, the error output in the Activity Log at Configuration () > System Logs (Utilities > Logs in WHMCS 7.x and earlier) when sending of emails via SMTP fails can lack verbosity. Alternatively, the underlying cause may be different from the message that the system ultimately displays. Adding the following line to the configuration.php file will output a lot of debugging information when you send mail manually. This requires that the Mail Type setting in the Mail tab at Configuration () > System Settings > General Settings is SMTP:

$smtp_debug = true;

After sending an email manually, the system will display the interaction between your server and the email server, for debugging purposes. After this process, be sure to revert the change to the configuration.php file.

Common Errors

The following are errors which may commonly appear in the activity log when attempting to send an email, resulting in email sending failure.

Could not connect to SMTP host

There are several possible reasons for this error:

  1. The SMTP settings in the Mail tab at Configuration () > System Settings > General Settings are incorrect. Check with your system administrator to verify that you have entered the correct SMTP host, port, username, and password, and that you have selected the appropriate SSL type for use with your mail server.
  2. The mail server is blocking connections from your WHMCS installation's server.
  3. Your WHMCS installation's server is blocking outgoing connections to the mail server.
  4. The system is using an inappropriate SMTP port and the SSL Type option is selected. For example, selecting TLS and the port number 256 would cause this error. For a list of the most common port assignments, see Mail Tab.
  5. The mail server is advertising that TLS connections are available, but when a secure connection is attempted it fails due to a certificate validation error. The appropriate solution would be to ensure that you have installed a validated certificate on the mail server. As a workaround, you can set the SMTPAutoTLS setting to false in /vendor/phpmailer/phpmailer/class.phpmailer.php. For more information, see the PHPMailer troubleshooting documentation.

Message body empty

A "Message Body Empty" error indicates that a syntax error occurred, preventing the email from sending. Review Configuration () > System Logs (Utilities > Logs > Activity Log in WHMCS 7.x and earlier) at the time of sending for entries beginning "Smarty Error". This will provide more information on the invalid syntax, which you will need to correct before attempting to send the email again.

The following recipients failed

This error is often due to a misaddressed email. Check the following locations to ensure a valid email address:

  • The client's Profile tab.
  • The client's Contacts tab.
  • BCC Messages in the Mail tab at Configuration () > System Settings > General Settings or, prior to WHMCS 8.0, Setup > General Settings.
  • Copy To when you edit a template at Configuration () > System Settings > Email Templates or, prior to WHMCS 8.0, Setup > Email Templates.
  • All administrator users at Configuration () > Manage Admins > Administrator Users or, prior to WHMCS 8.0, Setup > Staff Management > Administrator Users.

Check for blank spaces or punctuation before or after an email address in all the above locations.

Email Send Aborted By Hook

An "Email Send Aborted By Hook" error indicates that a custom hook has prevented the email from sending.

Take the following actions to begin troubleshooting this error:

  • Enable the Hooks Debug Mode option.
  • Replicate the error again.
  • Disable the Hooks Debug Mode option.
  • Review the Activity Log.
  • Locate the "Email Send Aborted By Hook" error in the log.

After locating the error look over the adjacent entries for a series of three lines that look similar to the following:

Hooks Debug: Hook File Loaded: /path/to/the/hook_file.php
Hooks Debug: Hook Defined for Point: EmailPreSend - Priority: 1 - Function Name: (anonymous function)
Hooks Debug: Attempting to load hook file: /path/to/the/hook_file.php

The file in the "Hook File Loaded" and "Attempting to load hook file" entries is the hook responsible for the "Email Send Aborted By Hook" error.

Contact the developer of that hook file for more information.

Email sending aborted.

An "Email sending aborted." error indicates that an unknown issue has prevented the email from sending.

This error commonly occurs when there is a configuration issue with the file paths in the Storage Settings section of the installation.

To remedy this, ensure that you have updated the storage locations. For more information, see the Moving Storage Locations guide.

Email sending aborted by configuration

In WHMCS 8.1, this error indicates that you have set Disable Email Sending to ON at Configuration () > System Settings > General Settings in the Mail tab. The system creates a log entry each time that you enable or disable this setting. For more information, see Disabling Outgoing Mail.

We recommend that you only enable this setting when you are testing updates or customizations on a development installation or while troubleshooting.

Emails Flagged as Spam

There are multiple reasons why systems may deliver emails from a WHMCS installation to a spam folder or reject them. Usually, this is due to the server configuration. WHMCS email templates should not trigger any standard spam rules.

First, check these points:

  • If you use PHP Mail, check whether you can use a different Mail Provider in the Mail tab at Configuration () > System Settings > General Settings. Many email providers block PHP mailer scripts as "unverified mail".
  • Verify that the email address you are sending from actually exists on your server, and whether it can send and receive mail normally.
  • Contact your web hosting or mail server provider for investigation into your IP reputation. They will be able to contact other email providers on your behalf.
  • If you suspect that the wording of an email may be triggering a filter, try customizing you email templates so they do not match every other WHMCS installation's emails.
  • Verify that your domain has an accurate and strict SPF record setup, as well as a correct PTR record.

Troubleshooting

Sometimes, the Activity Log error output lacks verbosity when sending emails via SMTP fails. Alternatively, the underlying cause may be different from the message that the system ultimately displays.

For version 8.0 and later

In WHMCS 8.0 and later, follow these steps if your Mail Provider is SMTP:

  1. Go to Configuration > System Settings > General Settings and select the Mail tab.
  2. Click Configure Mail Provider.
  3. Check SMTP Debug.
  4. Click Test Configuration.
  5. View the debugging output at Configuration > System Logs.

For version 7.x and earlier

In WHMCS 7 and earlier, adding the following line to the configuration.php file will output a large amount of debugging information when you send mail manually. This requires that the Mail Type is SMTP in the Mail tab at Configuration () > System Settings > General Settings:

$smtp_debug = true;

After sending an email manually, the system will display the interaction between your server and the email server, for debugging purposes. After this process, be sure to revert the change to the configuration.php file.