All mails going to gmail SPAM (sendmail on centos) 127.0.0.1 problem

gmailsendmailspamspf

UPDATE ON SPF CHECK http://www.openspf.org/Why:

The SPF check gives me this: An SPF-enabled mail server rejected a message that claimed an envelope sender address of support@ourdomain.com. An SPF-enabled mail server received a message from ourdomain.com (x.x.x.X) that claimed an envelope sender address of support@ourdomain.com. The domain ourdomain.com has authorized ourdomain.com (x.x.x.x) to send mail on its behalf, so the message should have been accepted. It is impossible for us to say why it was rejected

UPDDATE: I am using Google Apps to send email from and receive email from. Maybe this helps in researching our problem. We only have MX records for gmail set up and are now thinking this might be an issue? If a mailserver receives an email from www.ourdomain.com and cannot find an MX record for that IP, that might be bad or not?

all our mails are going to the gmail spam folder.
Mails are not spammy or bulky, just registration confirmation emails from our web app.

The SPF headers give me the following

Received-SPF: pass (google.com: best guess record for domain of apache@www.ourdomain.com designates x.x.x.x as permitted sender) client-ip=x.x.x.x;
Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of apache@www.ourdomain.com designates x.x.x.x as permitted sender) smtp.mail=apache@www.ourdomain.com
Received: from www.ourdomain.com (localhost [127.0.0.1])

where x.x.x.x is our full IP address

UPDATE
my complete mail and headers are now:

Delivered-To: solsol@gmail.com
Received: by 10.216.183.13 with SMTP id p13cs84787wem;
        Sat, 13 Nov 2010 09:00:00 -0800 (PST)
Received: by 10.229.214.139 with SMTP id ha11mr3256460qcb.235.1289667599435;
        Sat, 13 Nov 2010 08:59:59 -0800 (PST)
Return-Path: <support@ourdomain.com>
Received: from www.ourdomain.com (www.ourdomain.com [x.x.x.x])
        by mx.google.com with ESMTP id u7si11134289qco.191.2010.11.13.08.59.58;
        Sat, 13 Nov 2010 08:59:59 -0800 (PST)
Received-SPF: pass (google.com: domain of support@ourdomain.com designates x.x.x.x as permitted sender) client-ip=x.x.x.x;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of support@ourdomain.com designates x.x.x.x as permitted sender) smtp.mail=support@ourdomain.com
Received: by www.ourdomain.com (Postfix, from userid 48)
    id 5AB8F1C881; Sat, 13 Nov 2010 11:59:58 -0500 (EST)
To: solsol@gmail.com
Subject: Signup confirmation needed
From: Ourdomain.com <support@ourdomain.com>
Reply-To: Ourdomain.com <support@ourdomain.com>
MIME-Version: 1.0
Content-type: text/html;charset=UTF-8
Date: Sat, 13 Nov 2010 16:59:58 +0000
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Message-Id: <20101113165958.5AB8F1C881@www.ourdomain.com>

Hi! We're thrilled to have you on board!<br /><br />You are now just 1 t=
iny step away from securing your shiny new beta-account.<br /=
>Please click the following link to confirm.<br /><br /><br /><br /><a h=
ref=3D"http://www.ourdomain.com/default/beta/regconfirm/guid/7a8344e1ae=
04062c9c2495429255b5a0/id/76">Confirm your beta subscription</a><br /><b=
r /><br /><br />Have a good day!<br /><a href=3D'http://www.ourdomain.com.com'>ourdomain.com.com</a>

ps: I have set a correct SPF record that allows our x.x.x.x ip to send emails

UPDATE:

how can we make sure that google doesn't see us as spam. I've read that gmail will get an email from @ourdomain.com and it will run an nslookup or something to see if we actually have a receiving MX server set up?

Can someone confirm this and give me the nslookup command that I can test with. I'm confused as nslookup on ourdomain.com gives the correct MX records, but mxrecord on WWW.ourdomain.com doesnt.

The hostname of the machine we are sending with is www.ourdomain.com.
May that be a problem?

Best Answer

Have you changed your hostname? If the hostname of the server is localhost, localhost.localdomain, contains an IP address or doesn't resolve to your server you'll get this issue. Change it with:
hostname yourdomain.com and also in /etc/sysconfig/network.

Restart sendmail and then telnet to your server on port 25, it should say something like: 220 yourdomain.com ESMTP Sendmail, if not you may need to edit a sendmail config file as well.

In general, I find you will get spammed for one of the following reasons:

  • Bad hostname (as above)
  • No reverse DNS
  • No SPF record
  • You're blacklisted (Google for blacklist checker)
  • You're sending spam.

Good luck.