问题
Regarding this post about email verification,
using C#, how would you
- issue a VRFY command
- issue a RCPT command
回答1:
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.
回答2:
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.
回答3:
There's a nice project here with code snippets on how to achieve this, but as Spence mentioned they may not always work correctly.
回答4:
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
回答5:
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).
回答6:
You could try using something similar to this:
http://www.vcskicks.com/download-file-ftp.php
Instead of using Ftp, use SMTP.
来源:https://stackoverflow.com/questions/3045861/verifying-an-email-address-exist-in-c-sharp