Complete message received by Gmail (email, server ip and host are replaced):

Delivered-To: <myemail>
Received: by with SMTP id u4cs216052wif;
        Thu, 20 Oct 2011 03:22:03 -0700 (PDT)
Received: by with SMTP id 37mr1294749eet.51.1319106122223;
        Thu, 20 Oct 2011 03:22:02 -0700 (PDT)
Return-Path: <www-data@<serverdomain>>
Received: from <serverdomain> (<serverdomain>. [<serverip>])
        by mx.google.com with ESMTP id s55si2781134ees.156.2011.;
        Thu, 20 Oct 2011 03:22:02 -0700 (PDT)
Received-SPF: pass (google.com: domain of www-data@<serverdomain> designates <serverip> as permitted sender) client-ip=<serverip>;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of www-data@<serverdomain> designates <serverip> as permitted sender) smtp.mail=www-data@<serverdomain>
Received: by <serverdomain> (Postfix, from userid 33)
    id AEF1F47462EE; Thu, 20 Oct 2011 10:22:00 +0000 (UTC)
To: <myemail>
Subject: Registration confirmation
From: <sitename> mailing robot <no-reply@<serverdomain>>
MIME-Version: 1.0
Content-type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit
Message-Id: <20111020102200.AEF1F47462EE@<serverdomain>>
Date: Thu, 20 Oct 2011 10:22:00 +0000 (UTC)

Please confirm your registration on the site by clicking this link:

<A href="<confirmationlink>" target=_blank><confirmationlink></A>

What's wrong with this e-mail? Why does Gmail think it is spam?

  • A couple quick ideas: - Are the emails originating from a residential ip block? - It could simply be that someone has flagged a similar email as spam.
    – pguardiario
    Oct 28, 2011 at 3:09
  • 1. No. 2. I did not send it to anyone except my own gmail account yet.
    – mephisto123
    Oct 28, 2011 at 10:55
  • if one of your server is running Spamassassin, you could inspect its detailed results, they are added in the headers. It helps a lot, sometimes its about things as stupid as a bad MIME formating
    – chriscatfr
    Oct 29, 2011 at 7:59

9 Answers 9


Are you following their bulk senders guidelines? (Like the 'Precedence: bulk' header...)

I don't think the HTML in your mail is valid. No root element, etc. If you send HTML-only mails, you should make sure its HTML is correct.

Or even better: also include a plain-text version of your message (people like me, who use console e-mail clients, will thank you!). IMHO including a plain-text version will also decrease the probability of your message being considered a spam (most spams I see are HTML-only, and this is a criterion for SpamAssassin at least).

  • Just changed the message to plain text to make sure problem is not in the HTML. It seems it passes filter now. But actually I need to check it on another gmail account. Will do it tomorrow, since today everyone is sleeping already :) If it really helped, will give bounty to you :)
    – mephisto123
    Oct 29, 2011 at 1:51
  • Damn, can't award bounty now >< Because it got migrated :( Oct 29, 2011 at 13:11
  • That's cool, I'm just glad it helped :)
    – Schnouki
    Oct 31, 2011 at 0:32

I've been using my own dedicated servers for at least 5 years.

Sometimes google tags them as spam for 2 days, then when I check "not spam" in Gmail it's alright for another 6 months.

You should test

Also, the content of your email can influence google mail

  • Correct format (a simple test via telnet has the wrong format most of the time)
  • Keywords (using 'test' is a bad idea, it often ended in the spambox during my tests)

As I said, with the same content and absolutely no change in my settings, google has tagged them as spam for two days, and then stopped. Over 5 years, it has happened 3 or 4 times, but never for more than 48 hours at a time though.

  • if one of your server is running Spamassassin, you could inspect its detailed results, they are added in the headers. It helps a lot, sometimes its about things as stupid as a bad MIME formating
    – chriscatfr
    Oct 29, 2011 at 8:01

Is it on a shared hosting or dedicated server. If it is shared if someone from the same IP has sent bulk emails(say 25 or more), then possibility of IP getting black listed is possible. Other reason for being spam is by using some of the spam words. Often the spam is done through algorithms using data mining techniques, which means you need to train algorithm several times emails to your email ID from different IPs and mark it is not spam which is not feasible solution. The other way of getting this out, is making your site atleast little popular by providing backlinks, usually the techniques used for SEO. I'm telling you this with my practical experience with many of my websites, which I ran for few times and shutdown.

  • It is dedicated. Increasing popularity of the website is not possible atm, I'll try other advices mentioned in other answers first. Thank you for the answer anyway.
    – mephisto123
    Oct 28, 2011 at 17:41

If your server does not pass reverse domain lookup, gmail may put that inside spam.

  • It does. Received: from <serverdomain> (<serverdomain>. [<serverip>])
    – mephisto123
    Oct 20, 2011 at 10:56
  • not necessarily, check if your server has a static ip. is it behind a huge network or some dynamic dns service?
    – Ravi Bhatt
    Oct 20, 2011 at 10:58
  • Well, I've checked with nslookup (set type=ptr, server, <serverip> gives <serverdomain>)
    – mephisto123
    Oct 20, 2011 at 12:49
  • And yes, server has static IP. You can type its IP in browser and it will show site on default hostname.
    – mephisto123
    Oct 21, 2011 at 0:18

Since your headers appear to be correct, it's probably keying on something within the message. One of the things that SpamAssassin (no idea if this is what Gmail uses) keys on is a very short message like the above containing a hyperlink or graphic, so you may benefit by actually making your message a little longer. One of the ways to find out is to send it to your own gmail account and when it appears in your spam folder, examine the headers there for any added spam information. It may contain clues as to what spam engine Gmail is using or what rules your message is breaking.

  • These headers are taken from the real message sent to my own gmail account actually :) But I'll try to make message longer, thx for advice.
    – mephisto123
    Oct 27, 2011 at 21:40

Is the <confirmationlink> in the <serverdomain>?

That's a very short message, so it'd be easy for it to be flagged as spam if you are sending it from an address that doesn't match the domain of the link.

Some people might even hit the spam button just for the same reason.

  • Unfortunately, link is not in the serverdomain. Because there are few domains on the IP, and I can make it have correct reverse DNS records only for one domain.
    – mephisto123
    Oct 28, 2011 at 10:56
  • @mephisto123 you might want to try setting up the domain & a redirect rule to correct one. That way your domains will match.
    – eglasius
    Oct 28, 2011 at 19:01

Make sure your domain has proper MX records and a valid SPF record pointing to your sending mail server.

It is also possible the ip address assigned to your e-mail server had previously sent out spam.

Take a look at https://mail.google.com/support/bin/answer.py?answer=81126#authentication

  • Thanks for the answer. Yes, domain has proper MX record linked to main domain A record. And yes, domain has correct SPF record. Domain is not listed in public block lists.
    – mephisto123
    Oct 27, 2011 at 10:26

If you're sending it from a dynamic IP address then these are often flagged as spam. You can check your hosts chance to be detected as spam by adding the server's IP to the end of the following URL: http://www.spamhaus.org/query/bl?ip=

  • Server has static IP address. And it is not in any of blocklists listed on spamhaus.
    – mephisto123
    Oct 27, 2011 at 21:40

Check: - server identification does not match with the sender's domain - server is marked as spam source by gmail. Done it because they foud that many people have marked as spam previos messages from that server/domain - refers contents from third-party sources identified as insecure or spam sources themselves.

Not the answer you're looking for? Browse other questions tagged or ask your own question.