
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PHP, Web and IT stuff &#187; mail</title>
	<atom:link href="http://www.webdigi.co.uk/blog/tag/mail/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webdigi.co.uk/blog</link>
	<description>Little words of wisdom</description>
	<lastBuildDate>Sat, 04 Sep 2010 22:35:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to check if an email address exists without sending an email?</title>
		<link>http://www.webdigi.co.uk/blog/2009/how-to-check-if-an-email-address-exists-without-sending-an-email/</link>
		<comments>http://www.webdigi.co.uk/blog/2009/how-to-check-if-an-email-address-exists-without-sending-an-email/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 14:24:04 +0000</pubDate>
		<dc:creator>php-manual</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.webdigi.co.uk/blog/?p=19</guid>
		<description><![CDATA[We have all been doing email address validation for a very long time to make sure that the email is correctly formatted. This is to avoid users entering wrongly formatted email address but still they can accidentally give us a wrong email address.
Example of a correctly formatted email address but still wrong:
mailbox.does.not.exist@reddit.com [VALID email fromat [...]]]></description>
			<content:encoded><![CDATA[<p>We have all been doing email address validation for a very long time to make sure that the email is correctly formatted. This is to avoid users entering wrongly formatted email address but still they can accidentally give us a wrong email address.</p>
<p style="text-align: left;">Example of a correctly formatted email address but still wrong:</p>
<p style="text-align: center;"><strong>mailbox.does.not.exist@reddit.com</strong> [VALID email fromat but still not correct]</p>
<p style="text-align: left;">Above case specifically happens when you take important customer email on phone and you type in the wrong email. So is there a QUICK solution to really check the email without sending a test message to the user? Yes.<br />
<span id="more-19"></span></p>
<p><span style="text-decoration: underline;">The solution</span></p>
<p style="text-align: left;">A quick &amp; simple check below can be implemented in most programming language including PHP, Python etc. It relies on using the same SMTP which is used to send emails.</p>
<p>To check if user entered email <strong>mailbox.does.not.exist</strong><strong>@reddit.com</strong> really exists go through the following in command prompt.</p>
<p><strong>First </strong>- Find mail exchanger of reddit.com</p>
<p style="padding-left: 30px;">COMMAND:<br />
nslookup &#8211; q=mx reddit.com<br />
RESPONSE:<br />
reddit.com      MX preference = 10, mail exchanger = mail.reddit.com<br />
mail.reddit.com internet address = 208.96.53.70</p>
<p style="text-align: left;"><strong>Second </strong>- Connect to mail server mail.reddit.com</p>
<p style="text-align: left; padding-left: 30px;">COMMAND:<br />
telnet mail.reddit.com 25<br />
RESPONSE:<br />
220 mail.reddit.com ESMTP Postfix NO UCE NO UEMA  C=US L=CA Unsolicated electronic mail advertisements strictly prohibited, subject to fine under CA law CBPC 17538.45.  This electronic mail service provider&#8217;s equipment is located in the State of California.  See http://www.reddit.com/static/inbound-email-policy.html for more information.</p>
<p style="text-align: left; padding-left: 30px;">COMMAND:<br />
helo hi<br />
RESPONSE:<br />
250 mail.reddit.com</p>
<p style="padding-left: 30px;">COMMAND:<br />
mail from: &lt;youremail@gmail.com&gt;<br />
RESPONSE:<br />
250 2.1.0 Ok</p>
<p style="padding-left: 30px;">COMMAND:<br />
rcpt to: &lt;mailbox.does.not.exist@reddit.com&gt;<br />
RESPONSE:<br />
<strong>550 </strong>5.1.1 &lt;mailbox.does.not.exist@reddit.com&gt;: Recipient address rejected: User unknown in local recipient table</p>
<p style="padding-left: 30px;">COMMAND:<br />
quit<br />
RESPONSE:<br />
221 2.0.0 Bye</p>
<p>NOTES:</p>
<p>1) the <strong>550 </strong>response indicates that the email address is not valid and you have caught a valid but wrong email address. This code can be on the server and called on AJAX when user tabs out of the email field.  The entire check will take less than 2 seconds to run and you can make sure that the email is correct.<br />
2) If email was present the server will respond with a 250 instead of 550<br />
3) There are certain servers with a CATCH ALL email and this means all email address are accepted as valid on their servers (RARE but some servers do have this setting).<br />
4) Please do not use this method to continuously to check for availability of <span>gmail</span> / yahoo / <span>msn</span> accounts etc as this may cause your IP to be added to a blacklist.<br />
5) This is to supplement the standard email address javascript validation.</p>
<p><span style="text-decoration: underline;">Telnet screenshot in windows &#8211; Check email using SMTP commands</span></p>

<a href='http://www.webdigi.co.uk/blog/2009/how-to-check-if-an-email-address-exists-without-sending-an-email/checkemailtelnet/' title='Telnet on windows to check mail server using SMTP commands'><img width="150" height="150" src="http://www.webdigi.co.uk/blog/wp-content/uploads/2009/01/checkemailtelnet-150x150.png" class="attachment-thumbnail" alt="" title="Telnet on windows to check mail server using SMTP commands" /></a>

<p><strong><span style="text-decoration: underline;">UPDATE: PHP code added on 26th January 08</span></strong></p>
<p>1) <a rel="attachment wp-att-79" href="http://www.webdigi.co.uk/blog/2009/how-to-check-if-an-email-address-exists-without-sending-an-email/smtpvalidateclassphp/">SMTP check code in PHP &#8211; DOWNLOAD</a></p>
<p>2) <a href="http://www.webdigi.co.uk/blog/2009/how-to-check-if-an-email-address-exists-without-sending-an-email/checkemailexamplephp/">Usage example - DOWNLOAD</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdigi.co.uk/blog/2009/how-to-check-if-an-email-address-exists-without-sending-an-email/feed/</wfw:commentRss>
		<slash:comments>65</slash:comments>
		</item>
	</channel>
</rss>
