Troubleshooting Outbound Email Using Sugar Logs
Overview
If you find that outgoing emails, including the messages used for Test Email Settings, Workflow Alerts, Assignment Notifications, or Reminder Emails do not appear to be sent by Sugar® or are not being received, you can make use of Sugar's logging from within the application to troubleshoot potential causes. For more information about Sugar's logging capabilities, please refer to the article Introduction to Sugar Logging. While the method documented here will provide the top-level error that your email server is returning to Sugar, you may wish to refer to the article Troubleshooting Outbound Email Using Command Line for more in-depth insight into the source of failure should the Sugar Log's error message be insufficient.
Resolution
When the Outgoing Email system fails to work properly, the related errors are captured in the sugarcrm.log file as a FATAL error. Generally speaking, there will be a few lines of FATAL errors that explain why the Outgoing Email failed to work.
Viewing the Log
Follow the steps below to view these errors:
- Navigate to Admin > System Settings.
- Scroll to the bottom of the System Settings page and click the View Log link.
- A new tab will open displaying four buttons. Click "All" to display the full sugarcrm.log file.
- Use your browser's Find function (CTRL + F on Windows or command + F on Mac) to search this page for "SMTP".
- Locate the list of FATAL errors similar to the following:
[FATAL] SMTP -> ERROR: Failed to connect to server. Code: 111 Reply: Connection refused
[FATAL] SMTP -> ERROR: Password not accepted from server. Code: 535 Reply:535-5.7.1 Username and Password not accepted.
[FATAL] SugarPHPMailer encountered an error: SMTP Error: Could not authenticate.
[FATAL] SugarPHPMailer encountered an error: SMTP Error: Could not connect to SMTP host.
[FATAL] SugarPHP Mailer encountered an error: An outgoing mail server is not configured to send emails. Please configure an outgoing mail server or select an outgoing mail server for the mail account that you are using in Settings >> Mail Account.
SMTP Error Codes
Of particular importance in these error messages is the SMTP error code. In the above example, the Error Code is 5.3.5 Reply 535 – 7.7.1. The text after the Code explains the problem: the Username and Password were not accepted at the server. For this error code, you would navigate to Admin > Email Settings and enter the correct username and password for this mail account. Or, if the failed email was from an individual user's account rather than the system account, navigate to the Emails module (logged in as the affected user), click Settings > Mail Accounts, and edit the Outgoing SMTP account to have the correct username and password. Receipt of a test email sent from either of these pages would indicate the issue is resolved. For more information on sending a test email, please refer to the article Troubleshooting Outbound Email Using Sugar.
You may receive one of several other error codes - many of which are not so straightforward. For more information on these SMTP error codes, please refer to the table below courtesy of turbo SMTP. Please keep in mind that Sugar is passing to the log whatever message it receives back from your email server in the form of these error codes.
Error Code | Possible Error Message | Description |
500 | There is a syntax error in the command. | |
501 | There is a syntax error in the command's parameters or arguments. | |
502 | The command is not implemented. | |
503 | The server has either encountered a bad sequence of commands or the server requires authentication. | |
504 | A command parameter is not implemented. | |
510 and 511 | Bad email address. | |
512 | DNS Error | The host server for the recipient's domain name cannot be found. |
513 | Address type is incorrect | The email address is misspelled or there is an authentication issue. |
523 | The total size of your mailing exceeds the recipient's server limits. | |
530 | There is either an authentication problem, an invalid email address, or the recipient's server has denylisted your sending server. | |
541 | The recipient's server has rejected your message, usually due to an anti-spam filter. | |
550 | There is a non-existent email address on the remote side. | |
551 | User not local or invalid address – Relay denied | Your address or the recipient's address is not locally hosted by the server, so the relay has been interrupted. |
552 | Requested mail actions aborted – Exceeded storage allocation | The recipient's mailbox is full. |
553 | Requested action not taken – Mailbox name invalid | There is an incorrect email address in the To, CC, or BCC line. |
554 | The transaction has failed and the server will not try to send the message again. |
Additional Information
One error code you may encounter, especially if your instance is deployed on SugarCloud, is "111 Connection Refused", or error code 1.1.0, which indicates the same issue. In this case, your outbound email server is not accepting the request coming from Sugar, usually because the server is restricted to accepting requests from only a certain range of IP Addresses.
To troubleshoot and resolve this issue, please refer to the article Configuring Your SMTP Server to Work With SugarCloud.
Again, for more granular insight into Sugar's failure to send emails via your email server, please refer to the article Troubleshooting Outbound Email Using Command Line.