Wednesday, July 25, 2007

figuring out the gmail spam filters

So I'm working on a web application, and today I was trying to send invites out to some users. Turns out that they were going into the gmail spam filter.

I made sure that my RDNS (Reverse DNS) was set up correctly, and then I checked the email headers to ensure that gmail didn't suspect my ISP's IP address as a spammer IP.

A friend suggested that it might have something to do with the content of my emails, and not the body.

So I started playing around and, sure enough, that was it. After several emails I realized that it had to do with the link I was sending in the email. At first I thought that it might have to do with the length of the link (and an MD5-encoded token in the params).

After several tests I figured out exactly what trips it: If I send email from a server (hostname =, DNS and RDNS consistent with with a signup link for, then that sends the mail to spam. If, on the other hand, I send email from a server with a link to, then the email makes it through the spam filter.

That seems so non-intuitive to me. It seems more shady for an email from to have a link to in it.

Anyways, I've got a temporary work-around (I think?), but I still don't know the 'right' way do this.


vikas said...

maybe they have to let emails from one that links to another through because that's what emails from acquaintances tell you about a site would look like ... rather than looking like a company trying to get you to visit their own site?

HappyFunBall said...

Having a valid SPF entry in your DNS record will help a lot more than rDNS nowadays.