I have tried my best to recieve message on a gmail account using phpmailer but i can't. It shows message sent successfully but i don't recieve any message. I even edited the sendmail.ini file. This is the code:
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'vendor/autoload.php';
$mail = new PHPMailer(true);
//$mail->SMTPDebug = 2;
//$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'myemail@gmail.com';
$mail->Password = 'mypassword';
$mail->SMTPSecure = 'ssl';
$mail->Port = 587;
$mail->setFrom('myemail@gmail.com', 'Mailer');
$mail->addAddress('example@gmail.com', 'Joe User');
$mail->isHTML(true);
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
if($mail->send()){
echo 'Message has been sent successfully';
} else {
echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
}
I no so many questions concerning this have been answered but i still need help