-2

There is one TextBox and a Button name as Verify in my form. In this text box I'm always going to insert email address, so my question is that whenever I enter any email address into TextBox it must check whether an Email Address Which I entered in exists or not. For example if I enter "abc09@gmail.com" then it must check on the gmail server weather this address is present or not

using System.Windows.Forms;

namespace email_verifier
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void verify_Click(object sender, EventArgs e)
        {
        }
    }
}
Wasif Hossain
  • 3,900
  • 1
  • 18
  • 20
  • 1
    possible duplicate of [Using a regular expression to validate an email address](http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address) – Marco Acierno Mar 01 '14 at 08:04
  • @MarcoAcierno I wouldn't say that's a duplicate. This is rather how you ensure that you can actually send an email to that address. The "duplicate" is how you validate that it is a correct email address. – default Mar 01 '14 at 08:12
  • 1
    OP is not looking for validation at client side he is looking for serverside validation by checking wether EmailID already exists or not. – Sudhakar Tillapudi Mar 01 '14 at 08:14
  • The only way to "know" if an email address is valid is to *get a reply* via some means from something that *only* the particular email recipient should know (e.g. the "click e-mail confirmation link" step of registration). Some mail servers will report mail delivery failures (but due to proxies and whatnot it's not a synchronous operation unless you're directly talking to an authoritative SMTP server that *feels* like reporting address failures) .. not sure what gmail does these days. – user2864740 Mar 01 '14 at 08:16

2 Answers2

0

For example if I enter "abc09@gmail.com" then it must check on the gmail server weather this address is present or not

I typed "gmail validate email address" into Google and found this:

SMTP provides VRFY and EXPN verbs to check if an account or mailing list exists. However, most server admins disable these verbs from their mail configuration to prevent hackers from exploiting user lists. Gmail and Yahoo are said to have VRFY disabled.

Another option you can try for these servers is emailing the user with a link to confirm their email address. Granted, it is not as sexy as realtime email verification, but it is more secure for all parties.

Emphasis mine.

Community
  • 1
  • 1
ta.speot.is
  • 26,914
  • 8
  • 68
  • 96
-1

How about try to register a new account with the same name the user entered on the mail server, and track the server response to see whether it's a registered address or not.

It's a bit complicated, but I think it'll be work.

ssett
  • 432
  • 3
  • 6