0

My emails are being flagged as spam. How can I prevent this? Here's how I'm sending them:

public function sendMail($to,$subject,$from,$headers)
{
    $headers .= "From: ".$from. "<support@mydomain.com>";
    $headers .= "MIME-Version: 1.0" . "\r\n";           
    $headers .= "Content-type: text/html; charset=ISO-8859-1\r\n";
    $headers .= "X-Priority: 3\r\n";
    $headers .= "X-Mailer: smail-PHP ".phpversion()."\r\n"; 

    $message .= $this->getMessage();

    return mail($to,$subject,$message,$headers);    
}
Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179

1 Answers1

0

You can partially control it, add headers in correct format..use swiftmail or other apart from php mail() some mail servers feel bad if send via php mail()

Check for any blacklisting as well from mail servers.

Always test it on live wires, check FILTERS if you are using Yahoo.

swapnesh
  • 26,318
  • 22
  • 94
  • 126