I have one website in which I used PHPMailer function to send the emails to respective users but all the emails goes to spam or junk folder. I have used below code & include class.phpmailer.php file.
========================
try {
$mail->AddAddress($to, $toname);
$mail->SetFrom($from, $fromname);
$mail->Subject = $subject;
$mail->Body = $message;
$mail->Send();
$_SESSION['msg'] = "<div class='alert-success alert text-center'>Request send successfully. Please check your inbox to reset password.</div>";
} catch (phpmailerException $e) {
$_SESSION['msg']= "<div class='alert-error alert text-center'>".$e->errorMessage()."</div>"; //Pretty error messages from PHPMailer
} catch (Exception $e) {
$_SESSION['msg']= "<div class='alert-error alert text-center'>".$e->getMessage()."</div>"; //Boring error messages from anything else!
}
============================
Please suggest me solution for the same.
Thanks