i have changed the " enable less secure apps option of google mail ", and i am still getting this error from my gmail application.
require 'inc/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail = new PHPMailer;
$mail->IsSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com'; // Specify main and backup server
$mail->Port = 587; // Set the SMTP port
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = '*al********@gmail.com'; // SMTP username
$mail->Password = '****at****'; // SMTP password
$mail->SMTPSecure = 'tls';
$mail->From = '*al********@gmail.com';
$mail->FromName = '******i';
$mail->AddAddress('[email protected]', 'Ande C.'); // Add a recipient
$mail->IsHTML(true); // Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <strong>in bold!</strong>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->Send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
exit;
}
echo 'Message has been sent';
when i run the code, it gives me this error... " Message could not be sent.Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting " - what am i not doing right... and is there a better approach, or any preferrable SMTP servers that i could engage.. i need suggestions.
thanks.