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. Checking e-mail Accounts

Checking e-mail Accounts

Scheduled Pinned Locked Moved ASP.NET
com
7 Posts 6 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.
  • I Offline
    I Offline
    inayat basha
    wrote on last edited by
    #1

    hi all, when i am giving a mail-id in text box it has to check that the mail id is valid or not. Ex:if i give basha@gmail.com then it have to check the mail id is valid in gmail or not. Thanks & Regards, S.Inayat Basha.

    J S C D A 5 Replies Last reply
    0
    • I inayat basha

      hi all, when i am giving a mail-id in text box it has to check that the mail id is valid or not. Ex:if i give basha@gmail.com then it have to check the mail id is valid in gmail or not. Thanks & Regards, S.Inayat Basha.

      J Offline
      J Offline
      JimBob SquarePants
      wrote on last edited by
      #2

      Hi there, Just use a regular expression validator control with the appropriate regex. \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)* should do the trick. Cheers

      JimBob SquarePants ******************************************************************* "He took everything personally, including our royalties!" David St.Hubbins, Spinal Tap about Ian Faith, their ex-manager *******************************************************************

      S 1 Reply Last reply
      0
      • J JimBob SquarePants

        Hi there, Just use a regular expression validator control with the appropriate regex. \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)* should do the trick. Cheers

        JimBob SquarePants ******************************************************************* "He took everything personally, including our royalties!" David St.Hubbins, Spinal Tap about Ian Faith, their ex-manager *******************************************************************

        S Offline
        S Offline
        saini arun
        wrote on last edited by
        #3

        I think he wants to validate the existence of an email id in gmail. In this case even though the email format is valid but the check can still fail if it does not actually exists under gmail.

        1 Reply Last reply
        0
        • I inayat basha

          hi all, when i am giving a mail-id in text box it has to check that the mail id is valid or not. Ex:if i give basha@gmail.com then it have to check the mail id is valid in gmail or not. Thanks & Regards, S.Inayat Basha.

          S Offline
          S Offline
          saini arun
          wrote on last edited by
          #4

          Not very sure but you can check the google APIs for validating an email account. This is only way it can be done.

          1 Reply Last reply
          0
          • I inayat basha

            hi all, when i am giving a mail-id in text box it has to check that the mail id is valid or not. Ex:if i give basha@gmail.com then it have to check the mail id is valid in gmail or not. Thanks & Regards, S.Inayat Basha.

            C Offline
            C Offline
            coolestCoder
            wrote on last edited by
            #5

            Did you tried searching google ? In the first search itself, I found what you needed. Even you would have been able to see this[^], if you had tried.


            "A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder


            coolestCoder

            1 Reply Last reply
            0
            • I inayat basha

              hi all, when i am giving a mail-id in text box it has to check that the mail id is valid or not. Ex:if i give basha@gmail.com then it have to check the mail id is valid in gmail or not. Thanks & Regards, S.Inayat Basha.

              D Offline
              D Offline
              David Mujica
              wrote on last edited by
              #6

              Try something like this ... 1) have the user enter an email account 2) your application generates a link with a random number and sends it to the person for them to click on 3) when the user clicks on this link it will validate that the email account is valid. 4) put an expiration date for the link so that if they don't respond in 3 days the link becomes invalid. Just a thought. david

              1 Reply Last reply
              0
              • I inayat basha

                hi all, when i am giving a mail-id in text box it has to check that the mail id is valid or not. Ex:if i give basha@gmail.com then it have to check the mail id is valid in gmail or not. Thanks & Regards, S.Inayat Basha.

                A Offline
                A Offline
                April Fans
                wrote on last edited by
                #7

                Hi, you can use this class: class email_validation_class { //var $email_regular_expression="^([a-z0-9_] |\\- |\\.)+@(([a-z0-9_] |\\-)+\\.)+[a-z]{2,4}$"; var $timeout=0; var $localhost=""; var $localuser=""; Function GetLine($connection) { for($line="";;) { if(feof($connection)) return(0); $line.=fgets($connection,100); $length=strlen($line); if($length>=2 && substr($line,$length-2,2)=="\r\n") return(substr($line,0,$length-2)); } } Function PutLine($connection,$line) { return(fputs($connection,"$line\r\n")); } Function ValidateEmailAddress($email) { //return(eregi($this->email_regular_expression,$email)!=0); return(eregi("^([a-z0-9_] |\\- |\\.)+@(([a-z0-9_] |\\-)+\\.)+[a-z]{2,4}$",$email)!=0); } Function ValidateEmailHost($email,$hosts=0) { if(!$this->ValidateEmailAddress($email)) return(0); $user=strtok($email,"@"); $domain=strtok(""); if(GetMXRR($domain,&$hosts,&$weights)) { $mxhosts=array(); for($host=0;$host<count($hosts);$host++) $mxhosts[$weights[$host]]=$hosts[$host]; KSort($mxhosts); for(Reset($mxhosts),$host=0;$host<count($mxhosts);Next($mxhosts),$host++) $hosts[$host]=$mxhosts[Key($mxhosts)]; } else { $hosts=array(); if(strcmp(@gethostbyname($domain),$domain)!=0) $hosts[]=$domain; } return(count($hosts)!=0);

                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