All mails coming from my server has Received: (from www-data@localhost) even though I've set 127.0.0.1 mydomain.org mydomain server2 in /etc/hosts. I think that's the reason why it's ending up in the spam folder.
How can I change this Received: (from www-data@localhost)?
$headers = "Sender: " . $fromMail . "\r\n";
$headers .= "From: " . $fromMail . "\r\n";
$headers .= "Reply-To: ". $replayFromMail . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
mail($urow['email'],$subject,$notify,$headers);
I also tried adding -f [email protected]:
mail($urow['email'],$subject,$notify,$headers,"-f [email protected]");
Why I think it's related to spam problem?
This IP address is HELO'ing as "localhost.localdomain" which violates the relevant standards (specifically: RFC5321).
The CBL does not list for RFC violations per-se. This particular behaviour, however, correlates strongly to spambot infections. In other words, out of thousands upon thousands of IP addresses HELO'ing this way, all but a handful are infected and spewing junk. Even if it isn't an infection, it's a misconfiguration that should be fixed, because many spam filtering mechanisms operate with the same rules, and it's best to fix it regardless of whether the CBL notices it or not.