Ensuring that your users enter a valid contact email address for you site can be a tricky matter - if you simply allow them to enter a value based on a regular expression, it could be anything, even something invalid. On the other hand, there is a way that you can check both the validity (format) as well as the server that it should be coming from - all explained in this new article from DevShed.
Many applications in the field of Web development need to validate email addresses. While this can be done in a variety of ways, one simple but effective way involves writing your own functions in PHP. Alejandro Gervasion explains this approach.
Within the huge and fascinating field of Web development, one of the most common tasks that many applications have to deal with is, undoubtedly, verifying whether a user email address is valid. [...] Several approaches can be taken to address the problem, depending on the level of complexity desired for the validation itself.
They step through the process of validating the address, from checking it with a regular expression all the way up to making a socket connection to the MX record for the domain entered. Of course, this can only go so far, ensuring that the server exists, has an MX record and can be connected to - but that's more than some email validation routines check for.




