I am building my site at home with Drupal 8.8.1. But I cannot get mail sending to work with either swift pt phpmailer. With the latter, I get:

2020-01-06 23:12:34 Connection: opening to ssl://imap.gmail.com:993, timeout=30, options=array ( 'ssl' => array ( 'verify_peer' => 0, 'verify_peer_name' => 0, 'allow_self_signed' => 0, ),)
2020-01-06 23:12:34 Connection: opened
2020-01-06 23:12:34 SMTP -> get_lines(): $data is ""
2020-01-06 23:12:34 SMTP -> get_lines(): $str is "* OK Gimap ready for requests from 73.121.26.183 j2mb173597951ybh"
2020-01-06 23:13:04 SMTP -> get_lines(): $data is "* OK Gimap ready for requests from 73.121.26.183 j2mb173597951ybh"
2020-01-06 23:13:04 SMTP -> get_lines(): $str is ""
2020-01-06 23:13:04 SERVER -> CLIENT: * OK Gimap ready for requests from 73.121.26.183 j2mb173597951ybh
2020-01-06 23:13:04 CLIENT -> SERVER: EHLO 192.168.1.5
2020-01-06 23:13:04 SMTP -> get_lines(): $data is ""
2020-01-06 23:13:04 SMTP -> get_lines(): $str is "EHLO BAD Unknown command j2mb173597951ybh"
2020-01-06 23:13:34 SMTP -> get_lines(): $data is "EHLO BAD Unknown command j2mb173597951ybh"
2020-01-06 23:13:34 SMTP -> get_lines(): $str is ""
2020-01-06 23:13:34 SERVER -> CLIENT: EHLO BAD Unknown command j2mb173597951ybh
2020-01-06 23:13:34 SMTP ERROR: EHLO command failed: EHLO BAD Unknown command j2mb173597951ybh
2020-01-06 23:13:34 CLIENT -> SERVER: HELO 192.168.1.5
2020-01-06 23:13:34 SMTP -> get_lines(): $data is ""
2020-01-06 23:13:34 SMTP -> get_lines(): $str is "HELO BAD Unknown command j2mb173597951ybh"
2020-01-06 23:14:04 SMTP -> get_lines(): $data is "HELO BAD Unknown command j2mb173597951ybh"
2020-01-06 23:14:04 SMTP -> get_lines(): $str is ""
2020-01-06 23:14:04 SERVER -> CLIENT: HELO BAD Unknown command j2mb173597951ybh
2020-01-06 23:14:04 SMTP ERROR: HELO command failed: HELO BAD Unknown command j2mb173597951ybh
SMTP error: Could not authenticate.
2020-01-06 23:14:04 CLIENT -> SERVER: QUIT
2020-01-06 23:14:04 SMTP -> get_lines(): $data is ""
2020-01-06 23:14:04 SMTP -> get_lines(): $str is "* BAD invalid tag j2mb173597951ybh"
2020-01-06 23:14:34 SMTP -> get_lines(): $data is "* BAD invalid tag j2mb173597951ybh"
2020-01-06 23:14:34 SMTP -> get_lines(): $str is ""
2020-01-06 23:14:34 SERVER -> CLIENT: * BAD invalid tag j2mb173597951ybh
2020-01-06 23:14:34 SMTP ERROR: QUIT command failed: * BAD invalid tag j2mb173597951ybh
2020-01-06 23:14:34 Connection: closed
2020-01-06 23:14:34 Connection: opening to ssl://localhost:993, timeout=30, options=array ( 'ssl' => array ( 'verify_peer' => 0, 'verify_peer_name' => 0, 'allow_self_signed' => 0, ),)
2020-01-06 23:14:34 Connection failed. Error #2: stream_socket_client(): unable to connect to ssl://localhost:993 (Connection refused) [/srv/www/htdocs/kacb/public_html/vendor/phpmailer/phpmailer/class.smtp.php line 298]
2020-01-06 23:14:34 SMTP ERROR: Failed to connect to server: Connection refused (111)
SMTP error: Could not authenticate.
The website encountered an unexpected error. Please try again later.

Any clues about what might be wrong? Thunderbird works to the same gmail account on the same machine, so it is not a firewall issue (I also turned it off and tried).

Comments

vm’s picture

the following similar threads may aid: https://www.google.com/search?q=drupal+SMTP+error%3A+Could+not+authenticate.&rlz=1C1CHBF_enUS714US714&oq=drupal+SMTP+error%3A+Could+not+authenticate.&aqs=chrome..69i57j69i64l2.1921j0j7&sourceid=chrome&ie=UTF-8

Does email work previous to installing any drupal email modules? In other words, do you have an email server set up on your localhost?

The phpmailer module is in Beta, have you worked through the issue queue https://www.drupal.org/project/phpmailer

tjtj’s picture

I do not have 2-factor authentication enabled for this account, so there are no one-time passwords. Multiple people need to login. And first, as I said, I tried Swift Mailer, which gave the same result, but with less debugging information.