Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Validation of A Valid Email Domain

Validation of A Valid Email Domain

Scheduled Pinned Locked Moved ASP.NET
helpcsharpasp-netcomquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    HatakeKaKaShi
    wrote on last edited by
    #1

    Hey guys need ur help again. I need to check the valid email address using asp.net Below are the code i use hostName = "yahoo.com"; private bool ValidSMTP(string hostName) {            bool valid = false;          try          {                TcpClient smtpTest = new TcpClient();                smtpTest.Connect(hostName, 25);                if (smtpTest.Connected)                {                        NetworkStream ns = smtpTest.GetStream();                      StreamReader sr = new StreamReader(ns);                      if (sr.ReadLine().Contains("220"))                      { valid = true; }                      smtpTest.Close();                }          }          catch (Exception e)          {                string a = e.Message;          }          return valid; } However the error msg i receive is this "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host." Any solution or other methods of validating a exist email address? Thanks

    KaKaShi HaTaKe

    C 1 Reply Last reply
    0
    • H HatakeKaKaShi

      Hey guys need ur help again. I need to check the valid email address using asp.net Below are the code i use hostName = "yahoo.com"; private bool ValidSMTP(string hostName) {            bool valid = false;          try          {                TcpClient smtpTest = new TcpClient();                smtpTest.Connect(hostName, 25);                if (smtpTest.Connected)                {                        NetworkStream ns = smtpTest.GetStream();                      StreamReader sr = new StreamReader(ns);                      if (sr.ReadLine().Contains("220"))                      { valid = true; }                      smtpTest.Close();                }          }          catch (Exception e)          {                string a = e.Message;          }          return valid; } However the error msg i receive is this "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host." Any solution or other methods of validating a exist email address? Thanks

      KaKaShi HaTaKe

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      There is no way to check if a mail address is valid, apart from mailing it and seeing if you get a bounceback message. Even that is not 100% accurate.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups