views:

711

answers:

6

Regarding this post about email verification,

using C#, how would you

  1. issue a VRFY command
  2. issue a RCPT command
+24  A: 

I think you will find that in many instances these functions will intentionally lie to you to defeat spammers. If there were a way to confirm an email is real other than having a user click on a validation (or unsubscribe....) link then spammers would be very happy people.

Just to be clear, the best way to verify an email address is to send a user an email containing a link, and wait for them to click on the link to verify they received the email. Any other technique (with the exception of a corporate/intranet environment) should fail and/or lie to defeat spammers.

Spence
I appreciate the advice, but the question was not 'what is the best way to verify an email'.
Kenneth J
Yes it is. Spence's is AN answer.
Mau
usually when faced with requirements like these, it is more useful to do root cause analysis on why this is required. it would turn out that the client has seen people with 'protected' email addresses which require first time senders to click on a link before the mail actually gets delivered. it would be simpler to stay with the conventional email address verification (link in email) and put some additional text asking the person providing the email to "whitelist" a particular email id (say: [email protected]) in advance.
kinjal
A: 

You could try using something similar to this:

http://www.vcskicks.com/download-file-ftp.php

Instead of using Ftp, use SMTP.

Meiscooldude
+3  A: 

There's a nice project here with code snippets on how to achieve this, but as Spence mentioned they may not always work correctly.

Adrian Faciu
I would have recommended this, too. You should check it out Ken.
Hinek
+2  A: 

Normally.

  • VRFY: Forget it. Seriously ;) No server will answer - no sane one. Was used too much by spammers.

    • For the rest: connect to server using TCP, "just do it" (i.e. program the SMTP handshake, then go on).
TomTom
+3  A: 

If you're not worried about public SMTP servers lying to you (take a look at section 2.11 here: http://tools.ietf.org/html/rfc2505), then the best way might actually be to open up a TcpClient to the server and run the SMTP protocol yourself. SMTP is a really, really easy protocol. You can pretty much learn everything you need to know from Wikipedia: http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol

Sean Edwards
+1  A: 

IMO, RCPT method is the best one, and I still use it everyday.

Here are the necessary code : http://mailsystem.codeplex.com/SourceControl/changeset/view/51422#541825

The class is quite heavy, you will have to pick the code snippet you need from the source code.

Pierre 303