<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: function code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 21 Aug 2008 04:17:52 GMT</pubDate>
    <description>DZone Snippets: function code</description>
    <item>
      <title>Validate email and domain</title>
      <link>http://snippets.dzone.com/posts/show/4022</link>
      <description>// Vlidate email and domain name&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;&lt;br /&gt;function validate_email($email){&lt;br /&gt;&lt;br /&gt;$exp = "^[a-z\'0-9]+([._-][a-z\'0-9]+)*@([a-z0-9]+([._-][a-z0-9]+))+$";&lt;br /&gt;&lt;br /&gt;if(eregi($exp,$email)){&lt;br /&gt;	if(checkdnsrr(array_pop(explode("@",$email)),"MX")){&lt;br /&gt;		print("$email is ok.&lt;br&gt;");&lt;br /&gt;			}else{&lt;br /&gt;			print("$email is ok. But domain is not.&lt;br&gt;");&lt;br /&gt;			}&lt;br /&gt;				}else{&lt;br /&gt;				print("$email is not ok.&lt;br&gt;");&lt;br /&gt;				}   &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;validate_email("shantanu.ok");&lt;br /&gt;validate_email("shantanu.ok@gmail.com");&lt;br /&gt;validate_email("shantanu.ok@fsjaldkfjlsfjsljflsfjsldk.com");&lt;br /&gt;&lt;br /&gt;?&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 15 May 2007 07:48:44 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4022</guid>
      <author>shantanuo (shantanu oak)</author>
    </item>
  </channel>
</rss>
