Difference between revisions of "Email Sending Issues"

From WHMCS Documentation

m (General Emails)
m (General Emails)
Line 15: Line 15:
  
 
'''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.
+
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>
+
There are a number of Email Templates that are not recorded in the Email Message Log to protect the sensitive data they contain:
 +
 
 +
* Automated Password Reset
 +
* Client Email Address Verification
 +
* Password Reset Validation
 +
 
 +
In addition to this, there a number of Email Templates that won't be CC'd or BCC'ed at the template level, these are:
 +
 
 +
* Password Reset Validation
 +
* Password Reset Confirmation
 +
* Automated Password Reset
  
 
===Product Welcome Email===
 
===Product Welcome Email===

Revision as of 10:54, 10 January 2019

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.

Emails Not Sending

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.

First, check these points:

  1. Ensure the email template is not disabled under Setup > Email Templates.
  2. There are no custom action hooks in the /includes/hooks and /modules/addons directories that could be preventing email sending.
  3. Can the email be sent manually?

If the issue is still not resolved:

  1. Do you see the email in the Utilities > Logs > Email Message Log page?
  2. Is there an error at the time of email sending under Utilities > Logs > Activity Log?

No Error in Activity Log:
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.

There are a number of Email Templates that are not recorded in the Email Message Log to protect the sensitive data they contain:

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

In addition to this, there a number of Email Templates that won't be CC'd or BCC'ed 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 email are typically related an issue with the creation of the account. As such please refer to Auto Setup Issues to troubleshoot.


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:

  1. Please ensure the 'Enable Ticket Notifications' options are ticked under Setup > Staff Management > Administrator Users > Edit
  2. The "Support Emails' option should also be ticked under Setup > Staff Management > Administrator Roles > Edit
  3. Finally, ensure the admin ticket notification emails are not disabled under Setup > Email Templates.

If the issue is still not resolved:

  1. Ensure the Setup > General Settings > Support tab > Disable Reply Email Logging option is UNticked and reproduce the issue.
  2. Is there an error at the time of email sending under Utilities > Logs > 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.


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:

  • Try using SMTP rather than PHP Mail under Setup > General Settings > Mail Tab. 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.
  • 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.
  • Verify 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 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:

$smtp_debug = true;

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.

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 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.
  2. The mail server is blocking connections from the server upon which WHMCS is installed.
  3. The server on which WHMCS is installed is blocking outgoing connections to the mail server.
  4. 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 listed on this page.
  5. 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

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.

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
  • The client's Contacts tab
  • Setup > General Settings > Mail tab > BCC Messages field
  • Setup > Email Templates > Edit > Copy To field
  • All administrator users under Setup > Staff Management > Administrator Users

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