Difference between revisions of "Email Sending Issues"
(→Troubleshooting) |
(→Emails Not Sending) |
||
Line 1: | Line 1: | ||
+ | Sometimes, the system may not send mail using the expected methods. The problem is usually a misconfiguration. | ||
+ | |||
Sometimes, the system may not send mail using the expected methods. The problem is usually a misconfiguration. | Sometimes, the system may not send mail using the expected methods. The problem is usually a misconfiguration. | ||
Line 9: | Line 11: | ||
First, check these points: | First, check these points: | ||
− | #Check whether you have disabled the email template in | + | #Check whether you have disabled the email template in '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > Email Templates'''. |
#Check whether custom action hooks that could prevent email from sending exist in the <tt>/includes/hooks</tt> and <tt>/modules/addons</tt> directories. | #Check whether custom action hooks that could prevent email from sending exist in the <tt>/includes/hooks</tt> and <tt>/modules/addons</tt> directories. | ||
#Check whether you can send the emails manually. | #Check whether you can send the emails manually. | ||
Line 15: | Line 17: | ||
If the above steps don't resolve the issue: | If the above steps don't resolve the issue: | ||
− | #Check whether any email | + | #Check whether any email appears at '''System Settings (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Logs > Email Message Log''' ('''Utilities > Logs > Email Message Log''' in WHMCS 7.x and earlier). |
− | #Check whether an error occurs at the time of email sending under | + | #Check whether an error occurs at the time of email sending under '''System Settings (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Logs > [[Activity_Logs|Activity Log]]''' ('''Utilities > Logs > Activity Log''' in WHMCS 7.x and earlier). |
'''No Error in Activity Log:'''<br/> | '''No Error in Activity Log:'''<br/> | ||
− | 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. | + | 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 that the Email Message Log doesn't record, in order to protect the sensitive data they contain. These are: | + | There are many '''Email Templates''' that the '''Email Message Log''' doesn't record, in order to protect the sensitive data they contain. These are: |
* Automated Password Reset. | * Automated Password Reset. | ||
Line 28: | Line 30: | ||
* Password Reset Validation. | * Password Reset Validation. | ||
− | In addition to this, there a number of Email Templates that the system won't CC or BCC at the template level. These are: | + | In addition to this, there a number of '''Email Templates''' that the system won't CC or BCC at the template level. These are: |
* Password Reset Validation. | * Password Reset Validation. | ||
Line 44: | Line 46: | ||
First, check these points: | First, check these points: | ||
− | #Check whether you have selected the 'Enable Ticket Notifications' options under | + | #Check whether you have selected the '''Enable Ticket Notifications''' options under '''System Settings (<i class="fa fa-wrench" aria-hidden="true"></i>) > Manage Admins > Administrator Users > Edit'''. |
− | #Check whether you have selected the | + | #Check whether you have selected the '''Support Emails''' option under '''System Settings (<i class="fa fa-wrench" aria-hidden="true"></i>) > Manage Admins > Administrator Roles > Edit'''. |
− | #Check whether the admin ticket notification emails are disabled under | + | #Check whether the admin ticket notification emails are disabled under '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > Email Templates'''. |
If the above steps don't resolve the issue: | If the above steps don't resolve the issue: | ||
− | #Check whether you have selected the | + | #Check whether you have selected the '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > General Settings > Support > Disable Reply Email Logging''' option. After deselecting it, attempt to replicate the issue. |
− | #Check whether there's an error at the time of email sending under Utilities > Logs > Activity Log. | + | #Check whether there's an error at the time of email sending under '''System Settings (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Logs''' ('''Utilities > Logs > Activity Log''' 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, 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. | + | 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 under '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > General Settings > Mail'''. 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. | ||
+ | |||
+ | * 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. | ||
+ | |||
+ | * 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''' 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 '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > General Settings > Mail > Mail Type''' is '''SMTP''': | ||
+ | |||
+ | <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. | ||
+ | |||
+ | ===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: | ||
+ | |||
+ | # The SMTP settings in the '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > General Settings > Mail''' tab 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 mail server is blocking connections from your WHMCS installation's server. | ||
+ | #Your WHMCS installation's server is blocking outgoing connections to the mail server. | ||
+ | #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 '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > General Settings > [http://docs.whmcs.com/Mail_Tab#SMTP_Port Mail > SMTP Port]'''. | ||
+ | #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==== | ||
+ | |||
+ | A "Message Body Empty" error indicates that a syntax error occurred, preventing the email from sending. Review '''System Settings (<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==== | ||
+ | |||
+ | 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. | ||
+ | *'''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > General Settings > Mail > BCC Messages''' text box. | ||
+ | *'''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > Email Templates > Edit > Copy To''' text box. | ||
+ | *All administrator users under '''System Settings (<i class="fa fa-wrench" aria-hidden="true"></i>) > Manage Admins > 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 [[Other_Tab#Hooks_Debug_Mode|Hooks Debug Mode]] option. | ||
+ | * Replicate the error again. | ||
+ | * Disable the Hooks Debug Mode option. | ||
+ | * Review the [[Activity_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. | ||
+ | |||
+ | |||
+ | {{troubleshooting}} | ||
==Emails Flagged as Spam== | ==Emails Flagged as Spam== |
Revision as of 13:56, 4 August 2020
Sometimes, the system may not send mail using the expected methods. The problem is usually a misconfiguration.
Sometimes, the system may not send mail using the expected methods. The problem is usually a misconfiguration.
Contents
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:
- Check whether you have disabled the email template in Configuration () > System Settings > Email Templates.
- Check whether custom action hooks that could prevent email from sending exist in the /includes/hooks and /modules/addons directories.
- Check whether you can send the emails manually.
If the above steps don't resolve the issue:
- Check whether any email appears at System Settings () > System Logs > Email Message Log (Utilities > Logs > Email Message Log in WHMCS 7.x and earlier).
- Check whether an error occurs at the time of email sending under System Settings () > System Logs > Activity Log (Utilities > Logs > Activity Log 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 that the Email Message Log doesn't record, 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 that 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 with the sending of the welcome emails are typically due to an issue with account creation. For more information, see Auto Setup Issues.
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:
- Check whether you have selected the Enable Ticket Notifications options under System Settings () > Manage Admins > Administrator Users > Edit.
- Check whether you have selected the Support Emails option under System Settings () > Manage Admins > Administrator Roles > Edit.
- Check whether the admin ticket notification emails are disabled under Configuration () > System Settings > Email Templates.
If the above steps don't resolve the issue:
- Check whether you have selected the Configuration () > System Settings > General Settings > Support > Disable Reply Email Logging option. After deselecting it, attempt to replicate the issue.
- Check whether there's an error at the time of email sending under System Settings () > System Logs (Utilities > Logs > Activity Log 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 under Configuration () > System Settings > General Settings > Mail. 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.
- 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.
- 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 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 Configuration () > System Settings > General Settings > Mail > Mail Type 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:
- The SMTP settings in the Configuration () > System Settings > General Settings > Mail tab 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 mail server is blocking connections from your WHMCS installation's server.
- Your WHMCS installation's server is blocking outgoing connections to the mail server.
- 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 Configuration () > System Settings > General Settings > Mail > SMTP Port.
- 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 System Settings () > 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.
- Configuration () > System Settings > General Settings > Mail > BCC Messages text box.
- Configuration () > System Settings > Email Templates > Edit > Copy To text box.
- All administrator users under System Settings () > Manage Admins > 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.
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 under Configuration () > System Settings > General Settings > Mail. 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.
- Check your mail server's IP address to verify that it's not in any blacklists at 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+, if your Mail Provider is SMTP, you can enable SMTP Debug in your SMTP configuration to view debugging output in the Activity Log.
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 Configuration () > System Settings > General Settings > Mail > Mail Type 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.