PDA

View Full Version : Validating email addresses



RetroGamer1991
09-26-2001, 03:01 PM
I need to know what is valid for email addresses. I know that all alphabet characters, numbers, underscores, dashes and those @ signs are valid. Is there anything else valid? And should I make the email address all lowercase, I dont think uppercase are valid, but I'm not sure if that makes a difference or not.

So far my code checks for @@ or .. and if for some reason the user enters this it will say its invalid. I'm guessing that @. or .@ is also invalid.

Please help. Thanks.

cerion
10-30-2001, 11:33 PM
Okay what I would check for are the following... There can only be one @ in the entire email address. And yes @. or .@ is invalid. An address must also end with a .com, .org, .net, etc. all those extensions. There is a fair sized list last time I checked so you may just want to check for it ending with a .<2 or 3 alpha characters here>? Or you can get the list, only problem is if the list increases (which I would not doubt) you will have to make patch updates for the users of your program for every new one. Also I don't think email addresses are valid if they begin with anything but an alpha or numerical character and they cannot have _@ or @_ or @- or -@, etc. Must be numerical or alpha before and after the @ symbol.

If I am missing anything, please just lemme know! I believe thats all though.