E-mail address validator

E-mail address validator

am 07.03.2005 08:37:02 von Craig Cockburn

http://www.siliconglen.com/software/e-mail-validation.html

Have adapted an existing well known script, and was unable to contact
the original author. Would be grateful to know if there are any further
bugs or shortcomings in the code

thanks

--
Craig Cockburn ("coburn"). SiliconGlen.com Ltd. http://SiliconGlen.com
Home to the first online guide to Scotland, founded 1994.
Scottish FAQ, wedding info, website design, stop spam and more!

Re: E-mail address validator

am 07.03.2005 09:02:52 von Simon Brown

A quick look at the code makes me wonder if it handles .info domains, also

/* domain name seems valid, but now make sure that it ends in a
three-letter word (like com, edu, gov) or a two-letter word,
representing country (uk, nl), and that there's a hostname preceding
the domain or country. */

--
Simon Brown
www.sysgem.com www.hb9drv.ch www.laax.ch
..
"Craig Cockburn" wrote in message
news:5KuFKzCeSALCFwse@siliconglen.com...
> http://www.siliconglen.com/software/e-mail-validation.html
>
> Have adapted an existing well known script, and was unable to contact
> the original author. Would be grateful to know if there are any further
> bugs or shortcomings in the code
>
> thanks
>
> --
> Craig Cockburn ("coburn"). SiliconGlen.com Ltd. http://SiliconGlen.com
> Home to the first online guide to Scotland, founded 1994.
> Scottish FAQ, wedding info, website design, stop spam and more!

Re: E-mail address validator

am 07.03.2005 09:20:44 von Hans-Peter Sauer

On 07/03/2005 08:02 Simon Brown gurgled:

> A quick look at the code makes me wonder if it handles .info domains, also
>
> /* domain name seems valid, but now make sure that it ends in a
> three-letter word (like com, edu, gov) or a two-letter word,
> representing country (uk, nl), and that there's a hostname preceding
> the domain or country. */
>

The bit of code following that comment says anything between 2 and 6
characters is a valid TLD (looks like the code was changed to handle
..museum but not the comment):

if (domArr[domArr.length-1].length<2 ||
domArr[domArr.length-1].length>6) {
// the address must end in a two letter or other TLD including museum
alert("The address must end in a top level domain (e.g. .com), or
two letter country.")
return false
}

Of course that isn't really validating it because ''me@foobar.wibble''
is not a valid e-mail address but the script says it is.

You would need to add an array containing a list of valid TLDs to make
it work properly.

Parish

Re: E-mail address validator

am 07.03.2005 09:24:29 von Alan Connor

On Mon, 7 Mar 2005 07:37:02 +0000, Craig Cockburn
wrote:

> http://www.siliconglen.com/software/e-mail-validation.html
>
> Have adapted an existing well known script, and was unable to
> contact the original author. Would be grateful to know if there
> are any further bugs or shortcomings in the code
>

Don't read java, per se, but the concept is pretty clear in the
code and comments, and I like it.

Hate web-based mail, though.

I already have recipes for procmail that make many of those
checks, but a complete shellscript filter patterned after your
code would be a better idea.

The next step would be to run a quick DNS check on the domain,
but only to have that contribute to the score of the mail, not
be the deciding factor: A lot of non-spamming 'third world' mail
servers don't have reverse-dns listings.

Maybe just:

$ host siliconglen.com
siliconglen.com A 209.157.129.155

$ host 209.157.129.155

Name: www.siliconglen.com
Address: 209.157.129.155

If it had no A record, the response would look like this:

$ host jke.de

jke.de A record currently not present

----------

Same for the 822 compliance: It shouldn't be the only deciding
factor, because a lot of 'third world' mail servers that are not
spammers don't send 822 compliant mail.

AC

Re: E-mail address validator

am 07.03.2005 09:36:46 von Simon Brown

Commercially I have Mercury on W2K and would like a web-based interface as
some customer sites only allow me to access my mail via HTML when I visit,
others let me access my POP3 server.
--
Simon Brown
www.sysgem.com www.hb9drv.ch www.laax.ch
..
"Alan Connor" wrote in message
news:1dUWd.3500$cN6.3381@newsread1.news.pas.earthlink.net...
>
> Hate web-based mail, though.
>

Re: E-mail address validator

am 07.03.2005 10:00:50 von Craig Cockburn

In message <1dUWd.3500$cN6.3381@newsread1.news.pas.earthlink.net>, Alan
Connor writes
>On Mon, 7 Mar 2005 07:37:02 +0000, Craig Cockburn
> wrote:
>
>> http://www.siliconglen.com/software/e-mail-validation.html
>>
>> Have adapted an existing well known script, and was unable to
>> contact the original author. Would be grateful to know if there
>> are any further bugs or shortcomings in the code
>>
>
>Don't read java, per se, but the concept is pretty clear in the
>code and comments, and I like it.
>
>Hate web-based mail, though.
>
It was really more for forms where an email is supplied for future
contact rather than web based email.

thanks for the comments


--
Craig Cockburn ("coburn"). SiliconGlen.com Ltd. http://SiliconGlen.com
Home to the first online guide to Scotland, founded 1994.
Scottish FAQ, wedding info, website design, stop spam and more!

Re: E-mail address validator

am 07.03.2005 10:36:37 von Alan Connor

On Mon, 7 Mar 2005 09:00:50 +0000, Craig Cockburn
wrote:

> In message
> <1dUWd.3500$cN6.3381@newsread1.news.pas.earthlink.net>, Alan
> Connor writes
>
>>On Mon, 7 Mar 2005 07:37:02 +0000, Craig Cockburn
>> wrote:
>>
>>> http://www.siliconglen.com/software/e-mail-validation.html
>>> Have adapted an existing well known script, and was unable
>>> to contact the original author. Would be grateful to know if
>>> there are any further bugs or shortcomings in the code
>>
>>
>>Don't read java, per se, but the concept is pretty clear in the
>>code and comments, and I like it.
>>
>>Hate web-based mail, though.
>
> It was really more for forms where an email is supplied for
> future contact rather than web based email.
>

The _bad_ thing about those, Craig, is that for people who use
pass-listing as a part of their spam-fighting repertoire, (more
and more as time goes by) the address the mail will be coming
from isn't given. Which is a _real_ drag.

And I have a thing about giving my address to people who won't
give me theirs in return.

I generally won't do it.

Whatever I need can be found elsewhere....

AC

Re: E-mail address validator

am 07.03.2005 23:15:57 von Dr John Stockton

JRS: In article <5KuFKzCeSALCFwse@siliconglen.com>, dated Mon, 7 Mar
2005 07:37:02, seen in news:uk.comp.misc, Craig Cockburn
posted :

>Subject: E-mail address validator

The body of a news article should stand alone, and not depend on any
header line.

>http://www.siliconglen.com/software/e-mail-validation.html

If an article is not complete, it is likely to be ignored, especially by
those reading News off-line.


>Have adapted an existing well known script, and was unable to contact
>the original author. Would be grateful to know if there are any further
>bugs or shortcomings in the code

Bound to be ...


I see no point in validating an address partially; the real question is
whether it is deliverable - and you cannot tell that without delivering.
Fx: mouse and keyboard noises. I've just changed a couple of my
addresses, while not connected to the Net; and you have no way of
observing that until I connect.

The only worthwhile tests, IMHO, are whether the field contains
something like an E-address, rather than being blank of containing
something else. For that, a test that it contains a "word"
something@something.something is sufficient.

Additionally, consider the case of people sharing a single name@ISP; you
should allow the commented forms such as Fred Jones and
xx@yyy.zz (Rene Dupont) so that they can tell who it is meant for.

See .

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
JL/RC: FAQ of news:comp.lang.javascript
jscr maths, dates, sources.
TP/BP/Delphi/jscr/&c, FAQ items, links.