12 Replies Latest reply: Aug 12, 2009 10:46 AM by 796440 RSS

    a method to check if the given email address is valid or no??

    843853
      a method to check if the given email address is valid or no??
        • 1. Re: a method to check if the given email address is valid or no??
          800282
          manpreet.msit wrote:
          a method to check if the given email address is valid or no??
          No.
          • 2. Re: a method to check if the given email address is valid or no??
            796440
            manpreet.msit wrote:
            a method to check if the given email address is valid or no??
            That depends on your definition of "valid," but in general, no.

            Read this: [http://www.regular-expressions.info/email.html]

            Don't just grab a regex and blindly use it. READ the article.
            • 3. Re: a method to check if the given email address is valid or no??
              791266
              I wish people stopped using bad email validations. Multiple sites say that my email address is invalid, and my email address doesn't look odd at all.
              • 4. Re: a method to check if the given email address is valid or no??
                843853
                kajbj wrote:
                I wish people stopped using bad email validations. Multiple sites say that my email address is invalid, and my email address doesn't look odd at all.
                Your email address is straightforward enough that it should match just about any naive validation. My regex in reply # 20 of http://forum.java.sun.com/thread.jspa?forumID=31&threadID=5179037 says your email address is valid.
                • 5. Re: a method to check if the given email address is valid or no??
                  791266
                  sabre150 wrote:
                  kajbj wrote:
                  I wish people stopped using bad email validations. Multiple sites say that my email address is invalid, and my email address doesn't look odd at all.
                  Your email address is straightforward enough that it should match just about any naive validation. My regex in reply # 20 of http://forum.java.sun.com/thread.jspa?forumID=31&threadID=5179037 says your email address is valid.
                  I agree. I don't know why they think it's invalid. My olny guess is that they either think that the ".se" is an invalid domain, or that my "name" is too short. I can't think of anything else.
                  • 6. Re: a method to check if the given email address is valid or no??
                    jwenting
                    they may think your "finally.se" is a fake name for some reason, or indeed that the account name is too short. So many domains require account names to be at least 6 characters long that quite a few people probably think it's some sort of legal or technical requirement that's universal.

                    As to validating email addresses: it's indeed impossible.
                    At best you can ascertain that an address is definitely invalid by sending a message to that address. If it bounces the address is invalid.
                    If it doesn't bounce, it MAY be valid or the server may just not bounce invalid emails (most servers these days don't bounce, the volume of bounced spam would swamp their bandwidth, any bounce message you get is therefore almost certainly a phishing scam).
                    • 7. Re: a method to check if the given email address is valid or no??
                      843853
                      manpreet.msit wrote:
                      a method to check if the given email address is valid or no??
                      Send an email to it with a mechanism for confirmation ( usually a web link, but can be by email return if it's for a mailing list or other non-web service ).
                      • 8. Re: a method to check if the given email address is valid or no??
                        jwenting
                        pm_kirkham wrote:
                        manpreet.msit wrote:
                        a method to check if the given email address is valid or no??
                        Send an email to it with a mechanism for confirmation ( usually a web link, but can be by email return if it's for a mailing list or other non-web service ).
                        That validates only if there's a human at the other end who bothers to send the required reply after actually getting the message.
                        It doesn't validate whether the address is a valid one on a mailserver somewhere.
                        • 9. Re: a method to check if the given email address is valid or no??
                          796440
                          jwenting wrote:
                          pm_kirkham wrote:
                          manpreet.msit wrote:
                          a method to check if the given email address is valid or no??
                          Send an email to it with a mechanism for confirmation ( usually a web link, but can be by email return if it's for a mailing list or other non-web service ).
                          That validates only if there's a human at the other end who bothers to send the required reply after actually getting the message.
                          Tha'ts generally what really matters anyway. I've got a valid, active yahoo email address. The address itself meets the rules of the RFC, so it'd pass any regex test of validity. The account is active, so when you send email to it, it won't bounce. I never, ever use it though. So in the end sending an email there is no different than sending it to a badly formatted address, or to a validly formatted one that doesn't correspond to an existing account. In all those situations, the email just falls in a hole.
                          • 10. Re: a method to check if the given email address is valid or no??
                            jwenting
                            ah, but you're assuming a specific protocol (probably SMTP).
                            I'm not :)
                            And a "valid" address doesn't have to be one where a person is sitting at the other end and responding.
                            • 11. Re: a method to check if the given email address is valid or no??
                              796440
                              jwenting wrote:
                              ah, but you're assuming a specific protocol (probably SMTP).
                              No, not assuming any transport protocol. Just giving an example of how an address can be valid in every sense but the one that really matters.
                              And a "valid" address doesn't have to be one where a person is sitting at the other end and responding.
                              There's one of the problems when this question is asked. There are many potentially, er, valid, definitions of "valid" here, and the OP isn't aware of that or doesn't think about it or about the ramifications.

                              Sure, it makes some sense to check at the front end that the thing isn't just gibberish, but ultimately, we want the email to be read by somebody (possibly by a piece of software rather than a human, but tha'ts irrelevant). Sending it to an address that nobody reads is, in the end, no different from sending it to a syntactically legal address that doesn't correspond to an existing mailbox, or from sending it to a syntactically invalid address. In any of these cases, nobody reads the message, so you might as well not have sent it.

                              We can detect certain failures, but some failures cannot be detected, and hence, success cannot be detected.
                              • 12. Re: a method to check if the given email address is valid or no??
                                843853
                                my email address doesn't look odd at all
                                try.catch@short.long.int