E-mail Address Validation for Ruby
Posted: Mon, 6 October 2008 | permalink | No comments
Making sure you get valid data from users is a constant headache. E-mail addresses just happen to be a particular piece of data that causes me pain and suffering at the day job, because when people put bad e-mail addresses into web apps we host, my mail queues clog up, and that makes me a sad and slightly (more) irritated sysadmin.
Since I work for a Rails hosting shop, and I like programming in Ruby, I got all industrious this weekend and put together EmailAddressValidator, a ruby class to validate an e-mail address via a regex or (optionally) DNS lookups (to make sure something might accept mail for the domain) and making (most of) a delivery attempt to an MX for the domain. It's not foolproof, but it'll stop my mailqueues from getting clogged with a fair percentage of the stuff that gives me ulcers. The fun part now is getting the customer base to (a) use the class at all, and (b) run it over their existing user address lists.
As an aside, if someone wanted to setup an SMTP server configured for a catchall on gmial.com, I think he or she would have a lot of juicy stuff in very short order.
Post a comment
All comments are held for moderation; markdown formatting accepted.