Checking if an email address exists [duplicate]
Possible Duplicate:
How to check if 开发者_运维百科an email address exists without sending an email?
How can you check if an email address actually exists (not just validating)? How do these guys do it: http://www.email-unlimited.com/tools/verify-email.aspx
It seems to work...
The SMTP protocol has the command RCPT that receives a mailbox on the server and may return an "ok" code if that mailbox exists. Note that some servers don't do this in order to prevent spammers from scanning for valid addresses.
What email-unlimited do is the following:
- Use the email domain to find the SMTP server
- Start a session with that SMTP server and send it the command RCPT TO:
- End the session
If the SMTP server returns an "ok" code in step 2, then they decide that the mailbox exists.
Found this at link: http://wiki.cdyne.com/index.php/CSharp_Email_Verification
- Open a new/existing project.
- In the Solution Explorer, right click the project you wish to add the service to and select "Add Web Reference." If "Add Web Reference" is not listed, select "Add Service Reference", then "Advanced", and then "Add Web Reference."
- Put the WSDL for Email Verification in the URL block. (ex: http://ws.cdyne.com/emailverifyws/emailverify.asmx?wsdl)
- Change "Web Reference Name" to something more usable, like "EmailVerify".
//Instantiate EmailVerify
EmailVerify.EmailVerify ev = new EmailVerify.EmailVerify();
//Assign ReturnValues to the VerifyEmail method and pass in: email and License Key
EmailVerify.ReturnValues rv = ev.VerifyEmail("info@cdyne.com", "0");
//Assign ReturnValues to the VerifyEmailWithTimeout method and pass in: email, timeout, and License Key
EmailVerify.ReturnValues rvt = ev.VerifyEmailWithTimeout("info@cdyne.com", "5", "0");
//Get the response for VerifyEmail (you can choose which returns to use)
Console.WriteLine(rv.ValidLicenseKey);
Console.WriteLine(rv.CorrectSyntax);
Console.WriteLine(rv.EmailDomainFound);
Console.WriteLine(rv.EmailDisposable);
Console.WriteLine(rv.DomainVerifiesEmail);
Console.WriteLine(rv.DomainAcceptsMail);
Console.WriteLine(rv.EmailVerified);
Console.WriteLine(rv.Timeout);
Console.WriteLine(rv.DomainServersDown);
Console.WriteLine(rv.GoodEmail);
//Get the response to VerifyEmailWithTimeout (only using chosen responses)
Console.WriteLine(rvt.EmailDisposable);
Console.WriteLine(rvt.DomainVerifiesEmail);
Console.WriteLine(rvt.DomainAcceptsMail);
Console.WriteLine(rvt.EmailVerified);
Console.WriteLine(rvt.Timeout);
Console.WriteLine(rvt.DomainServersDown);
Console.WriteLine(rvt.GoodEmail);
You connect to the SMTP server of the domain that is handling the email and ask it. More information here:
http://www.the-welters.com/professional/smtp.html
If you try the service you can see it connects to the SMTP server and tried to send an email to the email specified. The important thing is to connect to the SMTP server of the destination account. For SMTP commands see http://www.yuki-onna.co.uk/email/smtp.html
精彩评论