This is my index.php file
Please suggest what is wrong with the below code that i am not receiving mails or if there is any other easy way of sending emails.
<?php
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPAuth=false;
$mail->SMTPSecure='tls';
$mail->Host='smtp.gmail.com';
$mail->port='587';
$mail->isHTML();
$mail->Username='demoXXXXX@gmail.com';
$mail->Password='XXXXXX';
$mail->SetFrom('no-reply@gmail.com');
$mail->Subject = "Subject Text";
$mail->Body = "<i>Mail body in HTML</i>";
$mail->addAddress("parkingston@gmail.com");
if(!$mail->send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message has been sent successfully";
}
?>