troubleshooting Question

Emails sent through PHP form are marked as SPAM.

Avatar of djcybex
djcybexFlag for Slovenia asked on
PHPAntiSpamEmail Servers
25 Comments1 Solution1695 ViewsLast Modified:
Hello all!

I've been trying to solve this problem for 3 days with no luck. After reading numerous different solutions and testing them with no luck, i run out of ideas.
I am running 5 websites on my own dedicated server. Server is using Postfix.

Any email sent through php form is getting marked as SPAM but ONLY by Gmail.... Homail and Yahoo are working OK... at least for now.

What have I tried:
## /etc/php.ini ##
sendmail_path = /usr/sbin/sendmail.postfix -t -i

## /etc/postfix/main.cf ##
myhostname = server.domain.com
mydomain = domain.com
myorigin = $myhostname
header_checks = regexp:/etc/postfix/header_checks

## /etc/postfix/header_checks ##
/^Received:.*\[127\.0\.0\.1\]/         IGNORE
/^Received:.*\from apache@localhost/   IGNORE

## /etc/hosts ##
127.0.0.1       server.domain.com server localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
IP.OF.THE.SERVER   server.domain.com server

## /etc/sysconfig/network ##
HOSTNAME=server.domain.com

## php headers ##
/* I've tried different combinations with and without -f flag. Messages are HTML.*/
$header = "From: " . $from_name . " <" . $from . ">\n";
$header .= "Reply-To: " . $from_name . " <" . $from . ">\n";
$header .= "MIME-Version: 1.0\n";
$header .= "Content-Transfer-Encoding: 8bit\n";
$header .= "Content-type: text/". $type ."; charset=UTF-8\n";
$header .= "X-Mailer: PHP/" . phpversion() . "\n";
$header .= "X-Sender: <" . $from . ">\n";
mail($to_name . " <" . $to . ">", $subject, $message, $header, "-f" . $from))

## mail headers and message ##
Delivered-To:someone@gmail.com
Received: by 10.213.108.82 with SMTP id e18cs509976ebp;
        Sun, 20 Dec 2009 07:32:07 -0800 (PST)
Received: by 10.229.13.218 with SMTP id d26mr2937096qca.6.1261323126739;
        Sun, 20 Dec 2009 07:32:06 -0800 (PST)
Return-Path: <info@somedomain.com>
Received: from server.domain.com (server.domain.com [IP.OF.THE.SERVER])
        by mx.google.com with ESMTP id 11si8166729qyk.112.2009.12.20.07.32.05;
        Sun, 20 Dec 2009 07:32:06 -0800 (PST)
Received-SPF: pass (google.com: domain of info@somedomain.com designates IP.OF.THE.SERVER as permitted sender) client-ip=IP.OF.THE.SERVER;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of info@somedomain.com designates IP.OF.THE.SERVER as permitted sender) smtp.mail=info@somedomain.com
Received: by server.domain.com (Postfix, from userid 48)
      id 59D954DB80CD; Sun, 20 Dec 2009 15:32:05 +0000 (UTC)
To: test1234 <someone@gmail.com>
Subject: Conformation and Activation
From: SomeDomain <info@somedomain.com>
Reply-To: SomeDomain <info@somedomain.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-type: text/html; charset=UTF-8
X-Mailer: PHP/5.3.0
X-Sender: <info@somedomain.com>
Message-Id: <20091220153205.59D954DB80CD@server.domain.com>
Date: Sun, 20 Dec 2009 15:32:05 +0000 (UTC)


<html><head></head><body>Thank you for registering at SomeDomain.com<br>
Here is your account information:<br>
Username: <b>test1234</b><br>
Password: <b>test123</b><br><br>

Please click the link below to activate your account:<br>
(please note that you have to activate your account in 7 days or you will have to register again)<br>
<a href="http://www.somedomain.com/?a=1a26ee2607a573a6ef5d7c5ae8e9d292"><b>http://www.somedomain.com/?a=1a26ee2607a573a6ef5d7c5ae8e9d292</b></a><br><br>

If it was not you who registered at SomeDomain.com then please ignore this message!<br>
Please reply to this message if you have any further questions or comments.<br><br>

Best regards,<br>
SomeDomain Staff</body></html>

## SPF is set on ALL domains including hostname server.domain.com ##
v=spf1 a mx ~all

#############################################

Mails using linux direct command also get marked as spam.
[root@server ~]# mail -stest someone@gmail.com

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 25 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 25 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros