Validating E Mail Id

Results 1 to 6 of 6

Thread: Validating E Mail Id

  1. #1
    Ranjith Guest

    Default Validating E Mail Id

    hi,<BR> How can I validate an Email Id entered by the user.<BR><BR><BR><BR>

  2. #2
    Sathiya Guest

    Default RE: Validating E Mail Id

    I think currently they dont have anything to validate the email but you can write a function to see last 4 characters are .com and @symbol is in the email.

  3. #3
    Michael Swanson Guest

    Default RE: Validating E Mail Id

    Well, if you&#039re sending all information over the Internet, then you should make sure that there are no blank spaces, there is only one "@" symbol, and there is a valid "." and three character domain at the end.<BR><BR>If you could be sending in an *intranet* setting, then all bets are off. Unfortunately, many component authors forget about this important situation. How many times have you wanted to send e-mail to yourself@localhost, or in Lotus Notes, Mike_Swanson/US/Donnelly_Corporation?<BR><BR>Michael Swanson, MCSE, MCP+Internet<BR>Webmaster<BR>Donnelly Corporation<BR>

  4. #4
    Join Date
    Dec 1969

    Default RE: Validating E Mail Id

    Hope this helps...<BR><BR><BR><BR>&# 060;script LANUGAGE="JavaScript"&#062;<BR>&#060;!-- hide script <BR>function validEmail(email) { //field cannot be empty<BR> invalidChars = " /;,:"<BR> if (email == "") {<BR> alert("An email address is required.")<BR> return false<BR> }<BR><BR> for (i=0; i&#060;invalidChars.length; i++) { //field does not contain invalid characters<BR> badChar = invalidChars.charAt(i)<BR> if (email.indexOf(badChar,0) != -1) {<BR> alert("The email address cannot contain &#039/ ; , :&#039 characters.")<BR> return false<BR> }<BR> }<BR><BR> atPos = email.indexOf("@",1) //address must contain one "@" symbol<BR> if (atPos == -1) {<BR> alert("The email address must contain one &#039@&#039character. ")<BR> return false<BR> }<BR><BR> if (email.indexOf("@",atPos+1) != -1) { //address can contain only one "@" symbol<BR> alert("The email address must contain only one &#039@&#039character. ")<BR> return false<BR> }<BR><BR> periodPos = email.indexOf(".",atPos) //address has at least "." following "@"<BR> if (periodPos == -1) {<BR> alert("The email address must contain at least one &#039.&#039 following the &#039@&#039character.")<BR> return false<BR> }<BR><BR> if (periodPos+4 &#062; email.length) { //address has at least 3 characters after "."<BR> alert("The email address must contain at least three characters after the &#039.&#039 following the &#039@&#039character.")<BR> return false<BR><BR> }<BR> return true<BR>}<BR><BR>function submitIt(form) {<BR> if (!validEmail(form.EMailAddress.value)) { //check for valid email entry<BR> form.EMailAddress.focus()<BR><BR> return false<BR><BR> }<BR> <BR> return true<BR> <BR>}<BR><BR>// End hide script --&#062;<BR>&#060;/script&#062;<BR>

  5. #5
    e-mailer Guest

    Default RE: Validating E Mail Id

    You must remeber that there is other than .com .edu .net e-mail boxes. For example .fi .at .au .us and so on, which have only 2 letters after the dot.

  6. #6
    Michael Swanson Guest

    Default RE: Validating E Mail Id

    Excellent point. Thanks for correcting me. :)<BR><BR>Michael Swanson, MCSE, MCP+Internet<BR>Webmaster<BR>Donnelly Corporation<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts