Home How to check if email address exists in real world or not, by sending a request to smtp server in C#
Reply: 1

How to check if email address exists in real world or not, by sending a request to smtp server in C#

ali shaikh
ali shaikh Published in 2018-02-14 12:00:56Z

I am getting an error in smtp connection when I send a request to stmp server.

IList<MXServer> list = new List<MXServer>();

foreach (string line in result.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
    if (line.Contains("MX preference =") && line.Contains("mail exchanger ="))
        MXServer mxServer = new MXServer();
        mxServer.Preference = Int(GetStringBetween(line, "MX preference = ", ","));
        mxServer.MailExchanger = GetStringFrom(line, "mail exchanger = ");

Mert Gülsoy
Mert Gülsoy Reply to 2018-02-14 12:44:48Z

By using SMTP, you can ask the server if it has the user. SMTP is a text based protocol. But there are some important points:

  1. Every server checks for spam, either this or that way. So your IP address must be a CLEAN one. (not to be listed in spam lists)
  2. Even your IP is clean, repeatedly asking for an address may result your ip to be BANNED
  3. Most service providers bans smtp ports. So you may need a static IP address.
  4. Most servers check for reverse DNS record for inbound connections. So you may need a reverse DNS (PTR) record.
  5. You may need an SPF record.
  6. There are 2 ways to ask an SMTP server: a. VRFY command b. RCPT TO
  7. Most servers are not replying VRFY because of security reasons.

So here is an SMTP session example:

C: MAIL FROM:<mail@samlogic.com>
S: 250 OK
C: RCPT TO:<john@mail.com>
S: 250 OK
C: RCPT TO:<peggy@mail.com>
S: 250 OK 

Basically if you get 250 ... answer for a RCPT TO command 90% the email address is ok. Then you can abort the connection.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.30257 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO