Gunesh Asatkar
Gunesh Asatkar

Reputation: 1

Mail goes to spam using phpmailer

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

Upvotes: 0

Views: 1615

Answers (1)

Sarwar
Sarwar

Reputation: 415

If you are talking about GMail it has very good spam classfier and marks it spam on the basis of the source of the mail i.e.from where the request was sent for the mail. For other mail services try changing the content of the message.

Upvotes: 1

Related Questions