SMTP connect() failed

Hi!!
I have this problem when i send the test message. SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting.

My config.php file
define(“PHPMAILER”,1);
define(‘PHPMAILERHOST’, ‘smtp.unadresse.com’);
$phpmailer_smtpuser = ‘user_name@unadresse.com’;
$phpmailer_smtppassword = ‘my_password’;
define(‘PHPMAILERPORT’, 25);

define(‘PHPMAILER_SMTP_DEBUG’, 3);
define(‘SMTP_TIMEOUT’,30);
define(‘TEST’, 0);

Please somebody can help me?

1 Like

Please, help us to help you, cheers.

[quote]The information below will be super useful to those trying to help you:

The version of phpList you are using.
Your server version of PHP
The url to your installation where possible. (eg: domain.com/lists/admin)
Which browser (and version) you are using to view your site.
Is your installation self-hosted or on phplist.com (In which case, your best option is to submit a support ticket).
What exactly is the issue (screen snapshot can be helpful).
What you have done to try to fix the issue so far, including links to any documentation you have followed.

Be secure: please do not give passwords, ftp access details or email addresses out in the forums.[/quote]

@Dariuso Possibly you are using the wrong server or port number, or port 25 is blocked by your hosting company.

I work in localhost and the port 25 is open.

@Dariuso I tried your server settings in my phplist. When I sent a test message I got a clear explanation of the problem, regarding the hosts certificate not matching.

This output appears at the top of the page after you send a test message.

You might be able to work around the problem by not validating the certificate. Try adding this to the end of your config.php file

$phpmailer_smtpoptions = array (
    'ssl' => array(
        'verify_peer'  => false,
        'verify_peer_name'  => false,
        'allow_self_signed' => true
    )
);
1 Like

When i add this options at the en of my config.php file il have this log

Connection: opening to smtp.unadresse.com:25, timeout=30, options=array (
‘ssl’ => array ( ‘verify_peer’ => false,
‘verify_peer_name’ => false, ‘allow_self_signed’ => true, ),)

Connection: opened

SERVER -> CLIENT: 220 mailler20.lws-hosting.com ESMTP Postfix (Debian/GNU)

CLIENT -> SERVER: EHLO localhost

SERVER -> CLIENT: 250-mailler20.lws-hosting.com250-PIPELINING250-SIZE
26214400250-VRFY250-ETRN250-STARTTLS250-AUTH PLAIN LOGIN250-AUTH=PLAIN
LOGIN250-ENHANCEDSTATUSCODES250-8BITMIME250 DSN

CLIENT -> SERVER: STARTTLS

SERVER -> CLIENT: 220 2.0.0 Ready to start TLS

CLIENT -> SERVER: EHLO localhost

SERVER -> CLIENT: 250-mailler20.lws-hosting.com250-PIPELINING250-SIZE
26214400250-VRFY250-ETRN250-AUTH PLAIN LOGIN250-AUTH=PLAIN
LOGIN250-ENHANCEDSTATUSCODES250-8BITMIME250 DSN

CLIENT -> SERVER: AUTH LOGIN

SERVER -> CLIENT: 334 VXNlcm5hbWU6

CLIENT -> SERVER: aW5mb0B1bmFkcmVzc2UuY29t

SERVER -> CLIENT: 334 UGFzc3dvcmQ6

CLIENT -> SERVER: cHdkaW5mMjAxNQ==

SERVER -> CLIENT: 235 2.7.0 Authentication successful

CLIENT -> SERVER: MAIL FROM:my_email_adress

SERVER -> CLIENT: 553 5.7.1 my_email_adress: Sender address rejected: not owned by user info@unadresse.com

SMTP ERROR: MAIL FROM command failed: 553 5.7.1
my_email_adress: Sender address rejected: not owned by
user info@unadresse.com

The following From address failed: clintontsafack@gmail.com : MAIL FROM
command failed,clintontsafack@gmail.com: Sender address
rejected: not owned by user info@unadresse.com,553,5.7.1SMTP server
error: MAIL FROM command failed Detail:
my_email_adress: Sender address rejected: not owned by
user info@unadresse.com SMTP code: 553 Additional SMTP info: 5.7.1

CLIENT -> SERVER: QUIT

SERVER -> CLIENT: 221 2.0.0 Bye

Connection: closed

Connection: opening to smtp.unadresse.com:25, timeout=30, options=array (
‘ssl’ => array ( ‘verify_peer’ => false,
‘verify_peer_name’ => false, ‘allow_self_signed’ => true, ),)

Connection: opened

SERVER -> CLIENT: 220 mailler20.lws-hosting.com ESMTP Postfix (Debian/GNU)

CLIENT -> SERVER: EHLO localhost

SERVER -> CLIENT: 250-mailler20.lws-hosting.com250-PIPELINING250-SIZE
26214400250-VRFY250-ETRN250-STARTTLS250-AUTH PLAIN LOGIN250-AUTH=PLAIN
LOGIN250-ENHANCEDSTATUSCODES250-8BITMIME250 DSN

CLIENT -> SERVER: STARTTLS

SERVER -> CLIENT: 220 2.0.0 Ready to start TLS

CLIENT -> SERVER: EHLO localhost

SERVER -> CLIENT: 250-mailler20.lws-hosting.com250-PIPELINING250-SIZE
26214400250-VRFY250-ETRN250-AUTH PLAIN LOGIN250-AUTH=PLAIN
LOGIN250-ENHANCEDSTATUSCODES250-8BITMIME250 DSN

CLIENT -> SERVER: AUTH LOGIN

SERVER -> CLIENT: 334 VXNlcm5hbWU6

CLIENT -> SERVER: aW5mb0B1bmFkcmVzc2UuY29t

SERVER -> CLIENT: 334 UGFzc3dvcmQ6

CLIENT -> SERVER: cHdkaW5mMjAxNQ==

SERVER -> CLIENT: 235 2.7.0 Authentication successful

CLIENT -> SERVER: MAIL FROM:my_email_adress

SERVER -> CLIENT: 553 5.7.1 my_email_adress: Sender address rejected: not owned by user info@unadresse.com

SMTP ERROR: MAIL FROM command failed: 553 5.7.1
my_email_adress: Sender address rejected: not owned by
user info@unadresse.com

The following From address failed:my_email_adress : MAIL FROM
command failed,my_email_adress: Sender address
rejected: not owned by user info@unadresse.com,553,5.7.1SMTP server
error: MAIL FROM command failed Detail:
clintontsafack@gmail.com: Sender address rejected: not owned by
user info@unadresse.com SMTP code: 553 Additional SMTP info: 5.7.1

CLIENT -> SERVER: QUIT

SERVER -> CLIENT: 221 2.0.0 Bye

Connection: closed

Thanks youuuuuu @duncanc !!!
I have changed the gmail address to my unadresse addresse and with your options my problem has been solved.

@duncanc
But what am i do if i want to put a security ssl or tls??

You are already using tls, that was the original problem.

You should ask your hosting service for the correct settings to use tls explicitly.

@duncanc
ok. thanks you for your help.

@duncanc, In the case of TLS what should be the configuration? I am using phpList v 3.6.1. Earlier It was working fine. But recently our SMTP server compelled to only accept requests from TLS 1.2 enabled servers. So TLS 1.2 has been enalbed. There are other applications too works fine on the server but the phpList application has stopped sending mail recently.

Hello,
I am also playing around SMTP, its settings and further config as explained by @sapathan but here I need one more help ahead of all.
I am not clearly understand that what is the “Username” and “Password” used for setting of SMTP too.
Is it:
Username: user@nameofdomain.com (through which we send emails)
Password: The actual password w.r.t Username-Email or some other for it.
Please help and clarify it; so that I can also used SMTP for my lists too.

Thanks

Hi @Peteh2,

In my case, we have white-listed the server IP in the settings of our dedicated SMTP server for the server from where an SMTP email sending request is being triggered. So, there is no requirement of “Username” and “Password” for the authentication. All SMTP email sending requests would be allowed for the white-listed servers.

In case you want to supply a username and password for the SMTP authentication then set using:

// if you want to use smtp authentication when sending the email uncomment the following
// two lines and set the username and password to be the correct ones
//$phpmailer_smtpuser = 'smtpuser';
//$phpmailer_smtppassword = 'smtppassword';

uncomment the last two lines and set the proper values. The above configuration and other such additional configurations can be found in the “config_extended.php” file under the “config” folder which we can set in the “config.php” file.

An SMTP username and password depend on what you have created/provided in SMTP server. You can telnet your SMTP server and try to send and email for trial first.

In my case, SMTP mail server is: mail.xxxx.xxxx and username is user1@xxxx.xxxx.
Here, xxxx.xxxx is our organisation domain-name.

Hello @sapathan,
Thanks for the valuable information and kind help regarding SMTP basics.
I am new with VPS, so I can come across this.
Now I have also white-listed my IP for SMTP with “localhost” so, there is no requirement of “Username” and “Password” for the authentication.
Now I need the next infos that I have to add/edit in my config.php and in config_extended.php to use it with phpList.
As per the info provided by @Dariuso config.php:
Add/Edit config.php:

define(“PHPMAILER”,1);
define(‘PHPMAILERHOST’, ‘smtp.mydomain.com);
#$phpmailer_smtpuser = ‘user_name@example.com’;
#$phpmailer_smtppassword = ‘my_password’;
define(‘PHPMAILERPORT’, 25);

define(‘PHPMAILER_SMTP_DEBUG’, 3);
define(‘SMTP_TIMEOUT’,30);
define(‘TEST’, 0);
As well with the info given at here too: https://forums.phplist.com/viewtopic.php?f=35&t=39782

What is the correct SMTP info need to be included, when I am using SMTP with “localhost”?

Thanks for the help and support.

Hi @Peteh2,

You didn’t mention, whether you tried or not and get any error or not. Anyway, no need to make any changes to the “config_extended.php” file.

If you still face an error to send an email through an SMTP server, then you may try with local/LAN/static IP address instead of “localhost” for white-listing.

And, have you appended the below code block at the end of the “config.php” file?

$phpmailer_smtpoptions = array (
    'ssl' => array(
        'verify_peer'  => false,
        'verify_peer_name'  => false,
        'allow_self_signed' => true
    )
);

You should be able to TELNET your SMTP server from the phpList hosted server.

Hello @sapathan,
Thanks for Kind help and support.

Thanks

Welcome @Peteh2. This is the power of an open-source community that motivates you to help others.