Error sending email to example@domain.com SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

Hi everyone,
I am new to phplist. i just installed phplist 3.5.5 on CentOS8 running php7 and MariaDB 10.3.17 with Apache.
I have this problem of SMTP connect() failed.
I have done literally almost everything, firewall, i have checked forums, but am still getting the connect failed.
Anybody who can further assist in the troubleshooting will surely be of help.
thank you

@allanbett Look in config_extended.php for an explanation of smtp debug, that might help to see what the problem is.

hi @duncanc thanks for the response. Does the config_extended.php have to look the same as the config.php file?
here is my config.php file for the smtp settings;
define(‘PHPMAILERHOST’, ‘smtp.gmail.com’);
$phpmailer_smtpuser = ‘user@gmail.com’;
$phpmailer_smtppassword = ‘********’;
define(“PHPMAILERPORT”,‘587’);
define(“PHPMAILER_SECURE”,‘tls’);

@allanbett phplist does not use config_extended.php. See the comment at the start of config.php.

@duncanc okay. i had enabled smtp debugging but i couldn’t get those bugs on the top page. But just for clarity, where do we enable smtp debugging? Because i had to edit the class.phpmailer.php file to enable that debugging.

@allanbett It is explained in config_extended.php

//# SMTP debugging
// Enable debugging output by phpmailer when sending test emails
// See https://phpmailer.github.io/PHPMailer/classes/PHPMailer.PHPMailer.PHPMailer.html#property_SMTPDebug
// define('PHPMAILER_SMTP_DEBUG', 0);

Hi @duncanc thank you for that. i got more debug info. It could see:

SMTP Error: Could not authenticate.

Since i am a new user, am not allowed to post the whole output of the error message.
Otherwise, the SMTP could open the connection successfuly but then it would refuse authentication.

@allanbett You are trying to send through gmail. If that is your personal account then it probably won’t work very well due to a limit on the rate of sending. I don’t remember the details but you will need to change a gmail account setting to allow “less secure apps”.

Hi @duncanc how about O365?