Alex Wells website developer logo

Main menu

  • Home
  • Blog
    • Tutorials
    • Bookmarks
    • Website Q&A
    • Submit a Question
  • Web Development
    • Website Projects
    • WordPress
    • Portfolio
  • About me
    • Pinterest
  • Contact me
    • Website review
Follow Alex Wells on Twitter connect with Alex Wells on LinkedIn alex-wells.co.uk rss feed

Home > check if input is a valid email – PHP code

Post navigation

← Sanitize Database Inputs with PHP
Social Media and Its Role in the Business World →

check if input is a valid email – PHP code

Posted on June 13, 2012 by Alex Wells

This code snipit checks to see if the input is a valid email or not, it will even check to see if the domain name is in use so ‘fake’ email domains will be rejected, this will help keep your database clean!

1
<pre><code>function isValidEmail($email) { //Perform a basic syntax-Check //If this check fails, there's no need to continue if(!filter_var($email, FILTER_VALIDATE_EMAIL)) { return false; } //extract host list($user, $host) = explode("@", $email); //check, if host is accessible if (!checkdnsrr($host, "MX") && !checkdnsrr($host, "A")) { return false; } return true; }</code>

source: http://css-tricks.com/forums/discussion/17370/make-sure-email-field-is-valids/p1


Alex Wells Blog Post

Blog post by Alex Wells
Working as a Website developer I love nothing more then working waist deep in code, I have specific interests in PHP and WordPress development but mostly working with local businesses to provide them with a website that meets their needs. Contact me if you have a project in mind and would like to get an input from an experienced website developer.
Find Alex Wells on Twitter Alex Wells on LinkedIn Alex Wells on Google Alex Wells RSS feed

This entry was posted in Bookmarks. Bookmark the permalink.
->Share this post on Twitter

Post navigation

← Sanitize Database Inputs with PHP
Social Media and Its Role in the Business World →

Leave a Reply Cancel reply

Share this page

My Projects

Owlmarks.com

Web developer at

Website design bishops stortford

Twitter


alex-wells.co.uk RSS feed

Categories

  • Blog
  • Bookmarks
  • code
  • home
  • noPic
  • portfolio
  • Tutorials
  • Website Q&A
  • WordPress

Website Information

Cookie Policy
Blog Post List

Archives

  • May 2013
  • January 2013
  • December 2012
  • November 2012
  • October 2012
  • September 2012
  • August 2012
  • July 2012
  • June 2012
  • May 2012
  • April 2012
  • March 2012
  • February 2012
  • January 2012
  • December 2011
  • November 2011
  • October 2011
  • September 2011

Recent Posts

  • First impressions count – what does your website say about you?
  • Reduce the cost of a new website / redesign
  • Just how easy is it to update your own WordPress website?
  • The ongoing process of running a website
  • How to write good content

Contact me

info@alex-wells.co.uk
@alex_simpsons

Pages

  • About me
  • Alex-Wells.co.uk Blog Post List
  • Contact me
  • Cookie Policy
  • Pinterest
  • Portfolio
  • Submit a Question
  • Web Development
  • Website Projects
  • Website review

Share this page

58 queries in 0.612 seconds.
© Alex Wells 2013