I am configuring my linode server to send mail from my webapp to users. I could use GoogleApps, but the 500/day limit it too restrictive, hence I'm attempting to set it up myself.

I set up Exim4 on my server using these instructions provided by linode. All good. I tested sending an email to my gmail/yahoo using this command on the server:

$ echo "This is a test from myapp." | mail -s Testing myaddress@gmail.com

I do receive the email in my Gmail inbox (not marked as spam), and also in my Ymail (marked as spam). Wanting to not be marked as spam, I inspected the header of the email that was sent.

I see these lines (me obfuscating with XXX) in the gmail header:

Received-SPF: neutral (google.com: 69.XXX.XXX.XXX is neither permitted nor denied by best guess record for domain of root@mail.myapp.com) client-ip=69.XXX.XXX.XXX;
Authentication-Results: mx.google.com; spf=neutral (google.com: 69.XXX.XXX.XXX is neither permitted nor denied by best guess record for domain of root@mail.myapp.com) smtp.mail=root@mail.myapp.com

This is the header of the email that Yahoo receives:

Received-SPF: none (mta1192.mail.mud.yahoo.com: domain of root@mail.myapp.com does not designate permitted sender hosts)

So it seems like the SPF record was not set (which it wasn't). Since I own the domain, I went to insert this SPF text into my records:


To be exact, I set
1) the subdomain mail.myapp.com to an A record pointing to my IP.
2) a TXT record for "@" as "v=spf1 ip4:69.XXX.XXX.XXX a a:mail.myapp.com ~all"

This seems like all I should have to do appropriately set the ips/domain names as a SPF record. However, when testing gmail/yahoo again it continues to give me the same "Neutral" status on Gmail, and spam status on Yahoo.

I am suspecting that the Google Gmail / Yahoo Ymail servers must be caching my DNS information on their end, and I'll continue to get this "neutral/spam" status until the myapp.com DNS entry is flushed from their cache. Does anyone know if they do cache this info, and how long it typically takes before the SPF information is picked up? Anything else I might have done wrong or should check?


If I'm following your setup correctly you have your SPF record set on the root, but you are sending email from the sub-domain

if the 'envelope from' of the email is root@mail.myapp.com then you need to change the "@" txt record to "mail". if you were sending mail from root@myapp.com then your setup would be correct.

So something like this

;;in the myapp.com zone
@    IN   TXT  "v=spf1 ip4:69.XXX.XXX.XXX ~all" ;covers root@myapp.com
mail IN   A    69.xxx.xxx.xxx
mail IN   TXT  "v=spf1 ip4:69.XXX.XXX.XXX ~all" ;covers root@mail.myapp.com
  • I believe this was indeed my problem. I changed the TXT record to apply to "main", so it matches a sender like "root@mail.myapp.com". After making the change, I waited about 30minutes before the "Received-SPF: pass" appeared in emails sent to both Gmail and Ymail. Interesting side note: this still isn't enough to mark emails as non-spam for Ymail. So I'm going to try setting DKIM sigs next. – sghael Jul 12 '10 at 21:16

These records are subject to the same kind of TTL as regular A records. The TTL value informs other DNS servers how long it is safe to cache the record. Yours is set to 300 seconds (5 minutes). Some mailers/DNS-servers ignore TTL values below a certain limit though, so it can be hard to be 100% sure when a change has propagated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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