Recently one of my websites sent me an email that showed up in my Spam folder. I viewed the headers to see the SpamAssassin flags and was a little shocked. Two things were a complete surprise.
First, I learned that there was a flag for obfuscated HTML. You know, HTML with no carriage returns. When I create HTML emails in PHP I absolutely don’t add random carriage returns – I’m never ever going to actually look at this HTML!!! Big mistake! Apparently Spam filters think obfuscation is spammy. Blah. So I went into all of my PHP HTML email code and added \n to spots where I would normally have a carriage return in a normal HTML file. That removed this flag.
The next flag was for having too many bytes of image compared to the bytes of text. Are you kidding me? I have a small 300×60 6.5K logo at the top of emails. I’m being punished for using my logo and not writing super-long emails to offset this? I removed the logo, added an H1 tag with the domain name, and the flag went away. Side note, emails were not going to my test GMail inbox and suddenly when I removed the logo they did. I don’t think they use SpamAssassin, but it’s worth noting that their own Spam detection software did not like my small image in the emails.
Fixing both of these “issues” allowed SpamAssassin to deliver the exact same email without it being marked as Spam. I never knew that a small image and lazy HTML would lead to emails not being delivered to inboxes. I thought I had all this figured out by now. So wrong.