How to configure an email server so that outgoing emails are not classified as spam? I've spent the entire day on this and I'm puzzled by the results I'm getting.

Among other things, I have:

  • Added DNS record for SPF: v=spf1 mx a ptr ip4:35.666.24.123/32 ?all
  • Added DNS record for SenderID: v=spf2.0/pra,mfrom a mx ip4:35.666.24.123 ~all
  • Corrected reverse DNS records (so that when receiving servers want to verify that the IP address sending them mail actually belongs to the domain the mails are coming from)
  • Set up my server to sign every message with a DKIM key and added respective DNS records: _domainkey TXT o=~; [email protected] dkim._domainkey TXT v=DKIM1; p=MIG...QIDAQAB
  • Changed the HELO of my server to match the DNS records.

Here is my SpamAssassin score from http://dkimvalidator.com/:

SpamAssassin Score: 2.973
Message is NOT marked as spam
Points breakdown: 
 0.1 DKIM_SIGNED            Message has a DKIM or DK signature, not necessarily valid
 0.0 T_DKIM_INVALID         DKIM-Signature header exists but is not valid
 0.0 TVD_SPACE_RATIO        No description available.
 0.4 RDNS_DYNAMIC           Delivered to internal network by host with
                            dynamic-looking rDNS
 2.5 TVD_SPACE_RATIO_MINFP  Space ratio

The default threshold for marking as spam is score 5, so I'm barely below it. Throw one "viagra" in there and that's it! ;)

For comparison, here are the results using my ISP's email:

SpamAssassin Score: -0.719
Message is NOT marked as spam
Points breakdown: 
-0.7 RCVD_IN_DNSWL_LOW      RBL: Sender listed at http://www.dnswl.org/, low
                            [ listed in list.dnswl.org]
-0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)
                            [ listed in wl.mailspike.net]
 0.0 TVD_SPACE_RATIO        No description available.
-0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders

I sent the exact same email from both my own server and my ISP's email. Somehow the TVD_SPACE_RATIO_MINFP was flagged with a 2.5 penalty for only the message sent from my own server. According to their wiki, it's "the ratio of spaces to non-spaces in each paragraph". Is this a bug? Or is it counting spaces from metadata as well or something?

According to the validator, my ISP doesn't have SPF or DKIM records. Yet somehow SpamAssassin is giving them -0.7 while giving me 3.0? Also, I'm somehow flagged for invalid DKIM, yet it's not affecting the score? Why am I flagged when the validator also says (in a different section of the results) that the validation of my DKIM resulted in "pass"?

Edit: this is not a duplicate. This question is not about "how to write an email", it's about how to configure an email server. The parts regarding SPF, DKIM and HELO I already covered in my original post and explained the problems I had with them. Such problems are not described in the "duplicate" posts.


1 Answer 1


That should be the ratio of spaces to non-spaces in a paragraph... try trimming out some whitespace (or add a bunch more text), and that should reduce that factor in that particular SpamAssassin setup.

BTW, SpamAssassin setup is semi-arbitrary, so "your mileage may vary."

  • No, the same message is getting a different result depending on which server sent it.
    – bkoodaa
    Nov 4, 2016 at 22:17
  • Again, SpamAssassin is semi-arbitrary, and some rules may override others.
    – RVT
    Nov 4, 2016 at 22:29
  • Eg. The fact that you "fail DKIM" may make the SpamAssassin daemon more-critical of the message. (and the different clients may format mail a bit different, too)
    – RVT
    Nov 4, 2016 at 22:30

Not the answer you're looking for? Browse other questions tagged .