Drupal: Block Comment Spammers By eMail Country
Recently over at the site we’ve been being hit by comment spammers creating fake accounts and trying to make posts. They aren’t very smart because the fake accounts they create have names of randomly generated letters and numbers that stand-out like sore-thumbs. They also always use fake email addresses so they can never validate their accounts (and thus are never able to post anything). But the really stupid thing is that they always use a .CN (China) domain in their fake email addresses.
I had been manually deleting these accounts but after doing this 300 or 400 times I decided I had better things to do (like watching The Office) so I found a way to permanently block these particular spammers altogether by creating a Drupal Access Role to block all email address that end in .CN .. Now I know what you’re saying - you’re saying “But Randy, what about all your Chinese members?!” - Well, they’re just going to have to buck-up and get GMail accounts. It’s sad how just a few dirty spammers can ruin it for an entire country. 
How To Create an Access Control Rule In Drupal:
It’s really pretty simple. In the Administration menu find Access Control, then Access Rules and hit Add Rule.
For the type select “Deny”, and rule type select “e-Mail”. Then in the Mask field, enter:
%.cn
% is a wildcard, and the .cn is the TLD for China.. You could replace the % with “_” to mask out particular characters or use just about any combination to block out just about anything you want.
That’s how I was able to block all the dirty Chinese spammers in less than 40 seconds and go back to watching the adventures of Michael Scott, Jim and Pam …
Update On My Fight With Hotmail
Just a quick update on my ongoing struggle with Hotmail (original post HERE).
First a quick recap:
- About every 3 months Hotmail starts black-holing all email from my server. I contact Microsoft, they apologize and email starts flowing again.
- On September 23, I realized that Hotmail was rejecting all mail from my server and TO my server, but this time bouncing email with the following message:
SMTP error from remote mail server after MAIL FROM:<xxx> SIZE=2562: host mx2.hotmail.com [65.54.244.168]: 550 Your e-mail was rejected for policy reasons on this gateway. Reasons for rejection may be related to content with spam-like characteristics or IP/domain reputation problems. If you are not an e-mail/network admin please contact your E-mail/Internet Service Provider for help. For e-mail delivery information, please go to http://postmaster.live.com
- Hotmail promises they will fix the problem within 48 hours
- 49 hours pass and problem still not fixed.. I report it again and they promise they’ll fix it within 48 hours
- 49 more hours pass and it’s still not fixed, so I report it again
- Two days later they say they’ve found the problem and will let me know as soon as they “hear anything from the filtering team”
- So far, 10 days without being able to send mail to Hotmail users or RECEIVE mail from Hotmail members.
And, to be clear: I am not a spammer! Anybody that’s ever read this blog or that knows anything about GrownUpGeek.com knows that I am about as ANTI-Spam as anyone could be. My server has not been compromised, nor has Microsoft ever even claimed that even ONE piece of spam was detected from my server. Even their own “Smart Network Data Services” for email does not show any spam complaints.
In every email that I get from Microsoft, at the bottom is this Read more
It’s ME vs. MICROSOFT - Who Will Win ?
About every 90 days or so, Microsoft decides that GrownUpGeek.com is a spammer, and totally blacklists our IP. I don’t mean they send our mail into the Hotmail “bulk” folders, I mean they totally “blackHole” all of our email - it just goes nowhere.. This time around they are further insulting me by returning all my mail with the following lovenote: “550 Your e-mail was rejected for policy reasons on this gateway” - and I can’t even send email FROM hotmail TO my domain!Each time this happens I go to the Report Hotmail Email Problem page at Microsoft and file a report, they send me an email to do a bunch of tests, then after two or three days they fix their screwup and email starts being delivered again. Never once have they said they’re seeing spam coming from my server, never have they said there is a problem with my SPF or my SenderID file, they just say “sorry for the inconvenience”.
After this happened the second time I replied and complained a bit, and asked why they continued to blacklist my IP. After going back and forth a few times with a very helpful technician, he sent me an email from his HOME email address and indicated that my IP was blacklisted due to other spammers in the neighborhood. That’s right - other servers in my IP-block were sending out floods of spam, so Microsoft decides to blacklist the entire IP range. This is a bit like arresting everybody in an entire apartment complex because the guy down in apt. 3C is selling crack! So Microsoft’s super-sophisticated anti-spam techniques that they boast so much about boils down to finding a spammer then blocking all IP’s anywhere near it. And, if they find they accidentally blocked an innocent webmaster, they are totally clueless on what to do or how to fix it… I hardly think this is what Bill Gates had in mind, and I’m sure he knows nothing of how stupid his little MSN/Hotmail network appears to be..
This time around I again asked what Read more



