These are some of the most commonly occurring errors related to email delivery when using the SMTP method.
In most cases, this is not something which can be resolved within XF and investigation and resolution will be required by the sysadmin or host at the server level, except where specifically indicated.
1. Could not open socket.
Typical causes of this would be DNS failing to resolve, a problem with the network stack, or firewall settings causing the outbound connection to be blocked. The sysadmin or host would have to investigate.Code:Zend_Mail_Protocol_Exception: Queued, Email to member@localhost.com failed: Could not open socket - library/Zend/Mail/Protocol/Abstract.php:277
2. No connection has been established.
This could be firewall related, causing the outbound connection to be blocked. The sysadmin or host would have to investigate.Code:Zend_Mail_Protocol_Exception: Queued, Email to member@localhost.com failed: No connection has been established to smtp.gmail.com - library/Zend/Mail/Protocol/Abstract.php:319
3. Connection refused.
Possible causes of this are incorrect SMTP settings in the ACP -> Options -> Email Options: Email Transport Method, or a server port configuration issue. If the settings are correct, the sysadmin or host would have to investigate.Code:Zend_Mail_Protocol_Exception: Email to member@localhost.com failed: Connection refused - library/Zend/Mail/Protocol/Abstract.php:277
4. Connection timed out.
Typical causes of this would be a problem with the network stack, or firewall settings causing the outbound connection to be blocked. The sysadmin or host would have to investigate.Code:Zend_Mail_Protocol_Exception: Email to member@localhost.com: Connection timed out - library/Zend/Mail/Protocol/Abstract.php:277
5. Name or service not known.
The hostname cannot be resolved, either due to incorrect details which have been entered for the Automated Bounced Email Handler settings in the ACP -> Options -> Email Options, or a DNS failure.Code:Zend_Mail_Protocol_Exception: cannot connect to host; error = php_network_getaddresses: getaddrinfo failed: Name or service not known (errno = 0 ) -library/Zend/Mail/Protocol/Pop3.php:109
6. No address associated with hostname.
The hostname cannot be resolved due to incorrect details which have been entered for the Automated Bounced Email Handler settings in the ACP -> Options -> Email Options.Code:Zend_Mail_Protocol_Exception: cannot connect to host; error = php_network_getaddresses: getaddrinfo failed: No address associated with hostname (errno = 0 ) - library/Zend/Mail/Protocol/Pop3.php:109
7. Temporary failure in name resolution.
The hostname cannot be resolved due to a temporary DNS or network failure.Code:Zend_Http_Client_Adapter_Exception: Email to member@localhost.com failed: Unable to Connect to ssl://localhost.com:443. Error #0: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution - library/Zend/Http/Client/Adapter/Socket.php:235
8. Incorrect authentication data.
Confirm the SMTP settings in the ACP -> Options -> Email Options: Email Transport Method are correct. Another common cause is the host is intercepting traffic on the ports and redirecting it, which is common on residential connections when trying to send via an SMTP server outside of the ISP's. The sysadmin or host would have to investigate.Code:Zend_Mail_Protocol_Exception: Email to member@localhost.com failed: Incorrect authentication data - library/Zend/Mail/Protocol/Abstract.php:431
9. Sender address must match authenticated user.
This usually means the Default Email Address in the ACP -> Options -> Email Options does not match the SMTP settings in the ACP -> Options -> Email Options: Email Transport Method.Code:Zend_Mail_Protocol_Exception: Email to member@localhost.com failed: sender address must match authenticated user - library/Zend/Mail/Protocol/Abstract.php:431
These are some of the most commonly occurring errors related to email delivery when using the Default (PHP) method.
Checking the server mail log (typically in /var/log/maillog or similar) may help to identify the specific cause. If root access is not available (typically with shared hosting), contact your host.
In most cases, this is not something which can be resolved within XF and investigation and resolution will be required by the sysadmin or host at the server level, except where specifically indicated.
1. Unable to send mail.
This is a generic error, a typical cause of which is due to having no message transfer agent (MTA) installed, which is the default configuration for most servers. Installing Postfix or Sendmail (root access required) with no specific configuration should be enough to resolve it, otherwise the sysadmin or host would have to investigate.Code:Zend_Mail_Transport_Exception: Email to member@localhost.com failed: Unable to send mail. - library/Zend/Mail/Transport/Sendmail.php:137
2. Policy restriction in effect. The fifth parameter is disabled on this system.
Uncheck the "Set return path with -f parameter" option in the ACP -> Options -> Email Options: Email Transport Method.Code:Zend_Mail_Transport_Exception: Email to member@localhost.com failed: Unable to send mail. mail(): Policy restriction in effect. The fifth parameter is disabled on this system - library/Zend/Mail/Transport/Sendmail.php:137
Note that this may lead to lower deliverability and it will prevent bounce messages from being returned to the server properly.
3. Could not execute mail delivery program.
This is likely due to having no message transfer agent (MTA) installed, which is the default configuration for most servers. Installing Postfix or Sendmail (with no specific configuration) should be enough to resolve it, otherwise the sysadmin or host would have to investigate.Code:Zend_Mail_Transport_Exception: Email to member@localhost.com failed: Unable to send mail. mail() [<a href='function.mail'>function.mail</a>]: Could not execute mail delivery program '/usr/sbin/sendmail -t -i' - library/Zend/Mail/Transport/Sendmail.php:137
4. Bad parameters to mail() function, mail not sent.
There is no reference in the PHP source for the "Bad parameters to mail()" function so it could be related to a custom PHP build or patch. Restarting the mail daemon may resolve it, otherwise the sysadmin or host would have to investigate.Code:Zend_Mail_Transport_Exception: Email to member@localhost.com failed: Unable to send mail. mail(): Bad parameters to mail() function, mail not sent. -library/Zend/Mail/Transport/Sendmail.php:137
5. mail() has been disabled for security reasons.
The host has disabled the built in PHP mail() function, this is typical with free hosts. Contact the host and ask them to enable it; if they refuse to do so, in order to use any email functionality, you would need to find a new host.Code:Zend_Mail_Transport_Exception: Unable to send mail. mail() has been disabled for security reasons - library/Zend/Mail/Transport/Sendmail.php:137
6. Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set().
On a Windows server, the PHP mail function uses an SMTP server as configured in the php.ini file. To use mail(), the SMTP php.ini options must be configured accordingly and a local SMTP server set up. The sysadmin or host would have to do that. Alternatively, the ACP -> Options -> Email Options: Email Transport Method can be changed to SMTP and the relevant settings for a known SMTP server entered.Code:Zend_Mail_Transport_Exception: Email to member@localhost.com failed: Unable to send mail. mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() - library\Zend\Mail\Transport\Sendmail.php:137
7. 530 SMTP authentication is required.
On a Windows server, the PHP mail function uses an SMTP server as configured in the php.ini file. The SMTP php.ini options would have to be configured to allow PHP to connect without authentication, or alternatively, the ACP -> Options -> Email Options: Email Transport Method can be changed to SMTP, which allows authentication.Code:Zend_Mail_Transport_Exception: Email to member@localhost.com failed: Unable to send mail. mail(): SMTP server response: 530 SMTP authentication is required. - library\Zend\Mail\Transport\Sendmail.php:137
The first thing to establish is whether there are any ACP Server Error Log entries related to email delivery.
That can be checked in the ACP -> Tools -> Server Error Log
No ACP Server Error Log Entries
If there are no errors, this means XenForo has successfully processed the emails, handed them off to the server and they have been accepted.
From that point on, XenForo is no longer involved so the server mail log (typically in /var/log/maillog or similar) would have to be checked to determine whether the emails are being successfully sent. If root access is not available (typically with shared hosting), contact your host.
If there are entries in the server mail log related to failures, the sysadmin or host would have to investigate the cause; it could be due to firewall or blocked port issues, network connectivity, etc.
If the server mail log shows the emails as successfully delivered, the emails could be being flagged as spam. The domain can be whitelisted or set as a trusted domain in the recipient's email application to prevent that. There is also this guide which includes some steps to take to attempt to prevent it happening: https://xenforo.com/community/resources/dealing-with-spam-filters.366/
ACP Server Error Log Entries
If there are ACP Server Error Log entries related to email delivery, click on one of the following links depending on whether the Email Transport Method is Default (PHP) or SMTP:
If individual members are not receiving email, it is unlikely that there would be ACP Server Error Log entries and it could be due to several reasons.
1. A misunderstanding with regards to how certain emails are sent; in the case of unread threads for example, only a single email is sent until the member visits the thread and the newest post has been read or the thread is marked as read.
2. The member account status could have been automatically changed to Email invalid (bounced) due to too many bounces being received, which will prevent further emails being sent; in this case the member will see a message after logging in and will have to update their email address in order for the account status to be automatically changed back to Valid, which will result in future emails being sent.
Note that staff member account statuses will not be automatically changed to Email invalid (bounced) and emails will continue to be sent, as changing them to that state would break their ability to carry out certain staff-related actions. If required, staff member account statuses can be changed to that state manually, to prevent emails being sent.
3. Server IP addresses can become blacklisted by certain email providers. There have been many reports of emails to @hotmail, @Outlook, @Live, and other Microsoft operated domains failing. A request to mitigate the server IP address can be made here: https://support.live.com/eform.aspx?productKey=edfsmsbl3&ct=eformts&scrx=1
4. Emails being flagged as spam or delivered to spam folders is a common cause of failed email receipt. The domain can be whitelisted or set as a trusted domain in the recipient's email application to prevent that. There is also this guide which includes some steps to take to attempt to prevent it happening: https://xenforo.com/community/resources/dealing-with-spam-filters.366/
We use essential cookies to make this site work, and optional cookies to enhance your experience.