I'm using phpmailer to sending emails to users,but the email account which i send with to users,it wasn't created on the same hosting,it created on Office 365, I used SMTP authentication,when i sent emails to users they considered as spams_for example hotmail say :This sender failed our fraud detection checks and may not be who they appear to be . when i google the problem i found the following issues:
1) Email failed in SPF and DKIM checks: but on cpanel in email authorization,i make SPF and DKIM enabled, so as my hosting company mentioned "that help reduce the amount of spam." . Do i need to setup SPF and DKIM records manually at zone file?
2) My Hosting company advise to setup reverse DNS:but does this important for my problem?
Sending code :
$mail = new PHPMailer(true);
$mail->Host = "smtp.office365.com";
$mail->Port = 587;
$mail->SMTPSecure = '';
$mail->SMTPAuth = true;
$mail->Username = "xxxxxx";
$mail->Password = "xxxx";
$mail->SetFrom($from, 'Name');
$mail->addReplyTo($from);
$mail->SMTPDebug = 2;
$mail->SingleTo = true ;
$mail->clearAllRecipients();
for($i = 0 ; $i < count($to) ; $i++)
{
$mail->addAddress($to[$i]);
}
if(!is_null($cc))
{
foreach ($cc as $email)
{
$mail->addCC($email);
}
}
$mail->Subject = $subject;
$mail->IsHTML(true);
$mail->MsgHTML($body);
if(!$mail->send()) {
//echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
// return false ;
} else {
return true ;
}
So what do you advise me?