Email Address Validator
A Ruby library to help you validate e-mail addresses
Like any data, an e-mail address that you accept from a user cannot just be accepted at face value, it needs to be validated. It’s non-trivial to do this, though – not only do you have to make sure that it is formatted correctly (and this is harder than it first appears, as the rules for what constitute a valid e-mail address aren’t simple), you also have to make sure that the e-mail address will actually receive mail.
The EmailAddressValidator class tries, as much as possible without actually delivering an e-mail, to validate that an e-mail address is valid and will accept e-mail. It does this by regex validation, looking up the MXes for a domain, and making a (partial) delivery attempt.