Smtp quit working with 3.1.1

I upgraded from 3.2.6 to the 3.1.1 version with the same smtp info in the config file, but sending fails. However, when I comment out the smtp items below everything works great.
I contacted my server support and they assure me no changed have been made by them.
using:
PHP 5.6
PERL 5.20.2
Ruby 2.1.5p273
Python 22.7.9
Python 33.4.2
MySQL 5

the following are all defined and active

define(‘PHPMAILERHOST’, ‘mail.xxx.com’);
$phpmailer_smtpuser = ‘phpsmtp@xxx.org’;
$phpmailer_smtppassword = ‘********’;
define(‘PHPMAILERPORT’, 587);
define(“PHPMAILER_SECURE”,‘ssl’);

Any recommendations?

@johntrot Look on the event log page for any errors reported.

Otherwise enable smtp debug in your config file, then send a test message. The debug output will show the exchange with the smtp server.

Log…
Error sending email to johnb@justbcoz.us SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

debug on

@johntrot when you send the test message there will be debug output starting at the top of the page.

after discussing this with the server support team they had me change

PHPMailer/class.phpmailer.php: public $AuthType = ’ ';
to
PHPMailer/class.phpmailer.php: public $AuthType = ‘PLAIN’;
in each of the instances of PHPMailer being used on the website

everything is now working

If someone else is having the same problem, hope this helps!

@johntrot It is not clear what was broken by upgrading to phplist 3.3.1.

Can you explain what was shown in the debug output? if there is a configuration change required then that should ideally be done through phplist, not by changing the source code of phpmailer.

  1. they also had me set this to 'auto’
    define(“PHPMAILER_SECURE”,‘auto’);
  2. in PHPMailer they asked that I change the class.phpmailer.php: public $AuthType = ’ PLAIN’;
    everything worked …

I changed the public $AuthType = ’ PLAIN’ back to it’s original - public $AuthType = ’ ', set the debug to 1 and if failed again with the following. Hope this helps!

CLIENT -> SERVER: EHLO rplcnm.org
CLIENT -> SERVER: STARTTLS
CLIENT -> SERVER: EHLO rplcnm.org
CLIENT -> SERVER: AUTH CRAM-MD5
CLIENT -> SERVER: cG9zdG1hc3RlckBycGxjbm0ub3JnIDkxMjgzNTgwMjRlNTA0ZDdmOWE3YjE1NGJlMzNmYTEw
SMTP ERROR: Username command failed:
SMTP Error: Could not authenticate.
CLIENT -> SERVER: QUIT
SMTP ERROR: QUIT command failed: 235 ok, go ahead (#2.0.0)
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

this is the setup in version 3.2.6 that worked and the current setup in 3.1.1 config.php setup -----

define(‘PHPMAILERHOST’, ‘mail.xxxxxx.server.com’);
$phpmailer_smtpuser = ‘phpsmtp@xxxxxx.org’;
$phpmailer_smtppassword = ‘********’;
define(‘PHPMAILERPORT’, 587);

If more info is needed let me know. Sorry I am slow getting back to you… Hope this helps

@johntrot Thanks for copying those results. It looks like the phpmailer package has changed the way that it selects the authentication method, and now was choosing CRAM-MD5 instead of the usual LOGIN. Then for some reason that was failing.

If you are able, can you run the test again, i.e. without the code changes, but change the debug level to 3 instead of 1. That should show the server response which might explain why it is failing.

here is the debug info when set to three

Connection: opening to mail.s483.sureserver.com:587, timeout=5, options=array ()
Connection: opened
SERVER -> CLIENT: 220 s483.sureserver.com ESMTP
CLIENT -> SERVER: EHLO rplcnm.org
SERVER -> CLIENT: 250-s483.sureserver.com250-STARTTLS250-PIPELINING250-8BITMIME250-SIZE 0250 AUTH LOGIN PLAIN CRAM-MD5
CLIENT -> SERVER: STARTTLS
SERVER -> CLIENT: 220 ready for tls
CLIENT -> SERVER: EHLO rplcnm.org
SERVER -> CLIENT: 250-s483.sureserver.com250-PIPELINING250-8BITMIME250-SIZE 0250 AUTH LOGIN PLAIN CRAM-MD5
CLIENT -> SERVER: AUTH CRAM-MD5
SERVER -> CLIENT: 334 PDE4OTMxLjE0NzE4NjIwNzRAc210cC5zdXJlc2VydmVyLmNvbT4=
CLIENT -> SERVER: cG9zdG1hc3RlckBycGxjbm0ub3JnIDkxMjgzNTgwMjRlNTA0ZDdmOWE3YjE1NGJlMzNmYTEw
SERVER -> CLIENT:
SMTP ERROR: Username command failed:
SMTP Error: Could not authenticate.
CLIENT -> SERVER: QUIT
SERVER -> CLIENT: 235 ok, go ahead (#2.0.0)
SMTP ERROR: QUIT command failed: 235 ok, go ahead (#2.0.0)
Connection: closed
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

PHPMailer recommend ‘PHPMailerAutoload.php’; as the way to start phpmailer as it knows how to load the other classes used by PHPMailer… that is what I use on the other two instances where I use phpmailer.

@johntrot phplist is using the latest release of phpmailer that now will use CRAM-MD5 for authentication if the server supports that. Which your server does. The problem seems to be that an extra empty line is being sent by the server. phpmailer treats that as the response and fails because it does not contain the expected result code

CLIENT -> SERVER: cG9zdG1hc3RlckBycGxjbm0ub3JnIDkxMjgzNTgwMjRlNTA0ZDdmOWE3YjE1NGJlMzNmYTEw
SERVER -> CLIENT:
SMTP ERROR: Username command failed: 

But phpmailer then reads the real response, which is a 235 code indicating that the authentication was successful
SERVER -> CLIENT: 235 ok, go ahead (#2.0.0)

This might be a bug somewhere that causes an empty line to be returned. Can you run this again but with a debug level of 4? Sorry, I should have asked you to use that level before.

No apologies necessary.

here is the level 4 debug

Connection: opening to mail.s483.sureserver.com:587, timeout=5, options=array ()
Connection: opened
SMTP -> get_lines(): $data is ""
SMTP -> get_lines(): $str is "220 s483.sureserver.com ESMTP"
SERVER -> CLIENT: 220 s483.sureserver.com ESMTP
CLIENT -> SERVER: EHLO rplcnm.org
SMTP -> get_lines(): $data is ""
SMTP -> get_lines(): $str is "250-s483.sureserver.com"
SMTP -> get_lines(): $data is "250-s483.sureserver.com"
SMTP -> get_lines(): $str is "250-STARTTLS"
SMTP -> get_lines(): $data is "250-s483.sureserver.com250-STARTTLS"
SMTP -> get_lines(): $str is "250-PIPELINING"
SMTP -> get_lines(): $data is "250-s483.sureserver.com250-STARTTLS250-PIPELINING"
SMTP -> get_lines(): $str is "250-8BITMIME"
SMTP -> get_lines(): $data is "250-s483.sureserver.com250-STARTTLS250-PIPELINING250-8BITMIME"
SMTP -> get_lines(): $str is "250-SIZE 0"
SMTP -> get_lines(): $data is "250-s483.sureserver.com250-STARTTLS250-PIPELINING250-8BITMIME250-SIZE 0"
SMTP -> get_lines(): $str is "250 AUTH LOGIN PLAIN CRAM-MD5"
SERVER -> CLIENT: 250-s483.sureserver.com250-STARTTLS250-PIPELINING250-8BITMIME250-SIZE 0250 AUTH LOGIN PLAIN CRAM-MD5
CLIENT -> SERVER: STARTTLS
SMTP -> get_lines(): $data is ""
SMTP -> get_lines(): $str is "220 ready for tls"
SERVER -> CLIENT: 220 ready for tls
CLIENT -> SERVER: EHLO rplcnm.org
SMTP -> get_lines(): $data is ""
SMTP -> get_lines(): $str is "250-s483.sureserver.com"
SMTP -> get_lines(): $data is "250-s483.sureserver.com"
SMTP -> get_lines(): $str is "250-PIPELINING"
SMTP -> get_lines(): $data is "250-s483.sureserver.com250-PIPELINING"
SMTP -> get_lines(): $str is "250-8BITMIME"
SMTP -> get_lines(): $data is "250-s483.sureserver.com250-PIPELINING250-8BITMIME"
SMTP -> get_lines(): $str is "250-SIZE 0"
SMTP -> get_lines(): $data is "250-s483.sureserver.com250-PIPELINING250-8BITMIME250-SIZE 0"
SMTP -> get_lines(): $str is "250 AUTH LOGIN PLAIN CRAM-MD5"
SERVER -> CLIENT: 250-s483.sureserver.com250-PIPELINING250-8BITMIME250-SIZE 0250 AUTH LOGIN PLAIN CRAM-MD5
Auth method requested: UNKNOWN
Auth methods available on the server: LOGIN,PLAIN,CRAM-MD5
Auth method selected: CRAM-MD5
CLIENT -> SERVER: AUTH CRAM-MD5
SMTP -> get_lines(): $data is ""
SMTP -> get_lines(): $str is "334 PDE4OTMxLjE0NzE4NjIwNzRAc210cC5zdXJlc2VydmVyLmNvbT4="
SERVER -> CLIENT: 334 PDE4OTMxLjE0NzE4NjIwNzRAc210cC5zdXJlc2VydmVyLmNvbT4=
CLIENT -> SERVER: cG9zdG1hc3RlckBycGxjbm0ub3JnIDkxMjgzNTgwMjRlNTA0ZDdmOWE3YjE1NGJlMzNmYTEw
SMTP -> get_lines(): $data is ""
SMTP -> get_lines(): $str is ""
SMTP -> get_lines(): timed-out (5 sec)
SERVER -> CLIENT:
SMTP ERROR: Username command failed:
SMTP Error: Could not authenticate.
CLIENT -> SERVER: QUIT
SMTP -> get_lines(): $data is ""
SMTP -> get_lines(): $str is "235 ok, go ahead (#2.0.0)"
SERVER -> CLIENT: 235 ok, go ahead (#2.0.0)
SMTP ERROR: QUIT command failed: 235 ok, go ahead (#2.0.0)
Connection: closed
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

This appears to show the cause of the problem

SMTP -> get_lines(): $data is ""
SMTP -> get_lines(): $str is ""
SMTP -> get_lines(): timed-out (5 sec)

It seems that the smtp server is not responding within 5s. That looks odd because it does respond when other authentication methods are used. You might want to copy the last set of debug output to your hosting company to see whether they have any insight on what is happening.

Otherwise I don’t see any alternative to you having to make the code change for $AuthType.

Will check with them and let you know
Thanks for your help

@johntrot that is not true. Smtp works better with version 3.3.1. You just need to add below code at phpmailer folder

$this->smtp_conn = fsockopen(
$host=‘your smtp server’,
$port,
$errno,
$errstr,
$timeout
);