Error sending email SMTP connect() failed. Using phpList

I’ve installed MiaB on a linode server and I’ve setup PhPList like this:

define(‘PHPMAILERHOST’, ‘’);
$phpmailer_smtpuser = ‘’;
$phpmailer_smtppassword = ‘mypassword’;

and I get this error when I try to send an email: Error sending email to SMTP connect() failed.

Using the same settings on thunderbird works fine, does anyone know what the problem is?

Just a guess, but can you use STARTTLS rather than tls

Just tried it and it doesn’t work.

SMTP ERROR: Failed to connect to server: Network is unreachable (101)
SMTP connect() failed.

So what are the error logs showing?

Error sending email to SMTP connect() failed.

Is phpmailer on another Ubuntu instance? If so the error log is going to be located at /var/log/mail.err or the specific event may be logged in /var/log/mail.log

The important log will be the one on the MiaB instance itself.

The error message really doesn’t say much.

Or even better what are the results when you use SMTPDebug as outlined in the linked troubleshooting guide?

MiaB is on a linode server, PHPList is on another server.

phplist SMTPDebug is set and it shows this:

Connection: opening to, timeout=5, options=array ()
Connection: Failed to connect to server. Error number 2. "Error notice: stream_socket_client(): unable to connect to (Network is unreachable)
SMTP ERROR: Failed to connect to server: Network is unreachable (101)
SMTP connect() failed.

MiaB /var/log/mail.log shows nothing when I try to send a mail from phplist.

The log entry seems to suggest that the PHPList server cannot access the MiaB server on port 587, and the MiaB server showing nothing seems to support this.

From the PHPList server, do you get something similar to below:

$ curl
220 ESMTP Hi, I'm a Mail-in-a-Box (Ubuntu/Postfix; see
221 2.7.0 Error: I can break rules, too. Goodbye.

Has the provider of the other server blocked mail ports by chance? It looks to me as though you are unable to communicate out on port 587 from the error message that you posted. Maybe you can reach out to support and ask them if mail ports are blocked and to unblock if so.

Port was blocked, it is unblocked now and everything works. Thank you guys for you help @alento @openletter

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.