SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting code example

Example: Message could not be sent.Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

i solve it by adding this line of code:

$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);

im using ssl 465..

and its really important to do this on your gmail account.
basically turned it on.
"Access for less secure apps has been turned on"

Tags:

Php Example