I've just setup djbdns and qmail on a debian lenny server. I test sending to my gmail account with qmail-inject, the mail gets there but is in the spam folder. How can I fix this?

3 Answers 3


It will depend a lot on why it was classified as spam. Here are a couple of things to look at:

  • Is the "from" address you're sending from valid? E.g., could you send back to it from GMail? GMail may be checking to see if there's a route back.
  • Does the domain that the "from" address references use SPF? If so, is this server allowed to send email for the domain?
  • If this is a server you've acquired recently from a hosting company, is the IP address you're assigned a known "spam source" address? (E.g., because someone was using that address to send spam before the hosting company shut them down.) If you search for "spam blacklist" and such you'll find links helping you check that.
  • 1
    In addition to SPF, it's always a good idea to configure DomainKeys (DKIM) to sign all outgoing mail for your domain. It can significantly reduce chances of correspondence originating from your server to be sent to Junk folder by any properly configured mail service (including GMail). Oct 11, 2009 at 15:21
  1. Check if your IP is blacklisted in http://www.robtex.com/rbl.
  2. Check if your IP has a proper Reverse DNS
  3. If it goes to SPAM folder sometimes and goes to Inbox other times, and if you are sending HTML emails, check if HTML formatting is ok.

This would be in addition to the checks mentioned above.


Check the headers of your message in Gmail, with the "Show original" option of the dropdown menu next to the "Reply" button.
The Gmail SMTP server adds headers to your message ("Received", "Received-SPF", "Authentication-Results", ...) that can provide useful information.

  • same problem here, although SPF=pass and reverse DNS is also set up correctly
    – solsol
    Nov 11, 2010 at 17:33

You must log in to answer this question.