Verify an e-mail-adress - syntax and dns

I

Ingo Linkweiler

Has anyone a function/script to verify an e-mail-address?

It should:
a) check the syntax
b) verify an existing mailserver or DNS/MX records

ingo
 
B

Bjoern Schliessmann

Ingo said:
b) verify an existing mailserver or DNS/MX records

"Or"? That's two different things.

If you don't know already: Even if you test all this, it is still
possible that

- the target mail account doesn't exist
- the sender's IP is filtered by the server so he'll reject
- the localpart has syntax errors (allowed chars in the localpart
are up to the server)

Regards,


Björn
 
I

Ingo Linkweiler

Bjoern said:
"Or"? That's two different things.

If you don't know already: Even if you test all this, it is still
possible that

- the target mail account doesn't exist
- the sender's IP is filtered by the server so he'll reject

Yes, I know this.
But its still better than not checking it.
The script will be used as part auf a user registration page to avoid
dummy-inputs like "(e-mail address removed)"
 
M

Marc 'BlackJack' Rintsch

The script will be used as part auf a user registration page to avoid
dummy-inputs like "(e-mail address removed)"

The usual way to cope with this is sending out confirmation mails. No
need to check if the address is syntactically correct beforehand.

Ciao,
Marc 'BlackJack' Rintsch
 
I

Ingo Linkweiler

The usual way to cope with this is sending out confirmation mails. No
need to check if the address is syntactically correct beforehand.

yes, I do this allready. But it would be nice to do some checks before
to avoid wrong user inputs.
 
B

Bjoern Schliessmann

Ingo said:
yes, I do this allready. But it would be nice to do some checks
before to avoid wrong user inputs.

What do you do if the user inputs a "wrong" address? If you reject
with an error message, the medium intelligent user will enter
something like

(e-mail address removed)

as next try, circumventing your test.

Regards,


Björn
 
B

Ben Finney

Bjoern Schliessmann said:
What do you do if the user inputs a "wrong" address? If you reject
with an error message, the medium intelligent user will enter
something like

(e-mail address removed)

as next try, circumventing your test.

I believe Ingo is checking for the case where the user intended to
enter a valid email address, and made a typing error resulting in a
trivially invalid one.
 
B

Bjoern Schliessmann

Ben said:
I believe Ingo is checking for the case where the user intended to
enter a valid email address, and made a typing error resulting in
a trivially invalid one.

Ah. Good intention, but the same applies: Typos in the localpart are
not detectable. Typos in the domain part could mostly be easily
corrected by hand, too.

Regards,


Björn
 
F

Frithiof Andreas Jensen

Ingo Linkweiler said:
Yes, I know this.
But its still better than not checking it.
The script will be used as part auf a user registration page to avoid
dummy-inputs like "(e-mail address removed)"

Why bother, you will loose anyway:

For those kind of sites demanding registration for trivial usage (i.e. most
sites do) I use my own domain controlled by myself - the adress is valid for the
confirmation mail then, after I got what I came for (or after I found out that
this site was a waste of time, which happens entirely too often), the adress is
not valid anymore.

Cuts down the spamvertising a lot!
 
S

Steven D'Aprano

yes, I do this allready. But it would be nice to do some checks before
to avoid wrong user inputs.

Because you like reinventing the wheel and doing the same work twice?

By memory, in an thread about the same topic just a few days ago, Fredrik
Lundh posted a link to Perl's FAQs that suggests a method for "validating"
email addresses: treat it like a password and ask the user to type it
twice. That will protect against simple typos and input errors.

For everything else, send to it and see what happens.
 
C

Christophe

Steven D'Aprano a écrit :
By memory, in an thread about the same topic just a few days ago, Fredrik
Lundh posted a link to Perl's FAQs that suggests a method for "validating"
email addresses: treat it like a password and ask the user to type it
twice. That will protect against simple typos and input errors.

I hate that thing. When I see that, I type my email once and copy/paste
into the second edit box. This is useless AND annoying at the same time.
 
S

Steve Holden

Christophe said:
Steven D'Aprano a écrit :



I hate that thing. When I see that, I type my email once and copy/paste
into the second edit box. This is useless AND annoying at the same time.

Probably safe to say it's a little less useful when the text field
contents are visible, but the classic validator for hidden fields.

It might surprise you to realise that not everyone in the world is a
touch typist, and for them (since they are often looking at the keyboard
rather than the screen) it's not an unreasonable validator.

regards
Steve
 
G

Georg Brandl

Christophe said:
Steven D'Aprano a écrit :

I hate that thing. When I see that, I type my email once and copy/paste
into the second edit box. This is useless AND annoying at the same time.

It may be for you, but there certainly are users that misspel their
e-mail address more frequently, just like passwords. And therefore it's a
nice touch to spare both the original submitter and the owner of the
misspelled address more work.

Georg
 
C

Christophe

Georg Brandl a écrit :
It may be for you, but there certainly are users that misspel their
e-mail address more frequently, just like passwords. And therefore it's a
nice touch to spare both the original submitter and the owner of the
misspelled address more work.

Which proportion of the people that sometimes misspell their e-mail also
use cut&paste when faced with "please type your e-mail twice" web pages?
 
C

Christophe

Steve Holden a écrit :
Probably safe to say it's a little less useful when the text field
contents are visible, but the classic validator for hidden fields.

It might surprise you to realise that not everyone in the world is a
touch typist, and for them (since they are often looking at the keyboard
rather than the screen) it's not an unreasonable validator.

Well, if they have a hard time using a keyboard, I've no doubts they
will love using cut&paste to cut nearly in half the time needed to fill
out your form :)
 
F

Fredrik Lundh

Frithiof said:
For those kind of sites demanding registration for trivial usage (i.e. most
sites do) I use my own domain controlled by myself - the adress is valid for the
confirmation mail then, after I got what I came for (or after I found out that
this site was a waste of time, which happens entirely too often), the adress is
not valid anymore.

and for those that are too lazy for that, there's always mailinator.com
and friends.

</F>
 
G

Georg Brandl

Christophe said:
Georg Brandl a écrit :

Which proportion of the people that sometimes misspell their e-mail also
use cut&paste when faced with "please type your e-mail twice" web pages?

I don't know. But really, it doesn't matter. The cut-and-paste operation
(which is done at least partially using the mouse by most such people) needs
a lot of "eye contact" with the thing cut and pasted, so there's a lot
more chances to realize that the address is wrong.

Georg
 
S

Steven D'Aprano

Steven D'Aprano a écrit :

I hate that thing. When I see that, I type my email once and copy/paste
into the second edit box.

So do I -- even for passwords. (Oooh, I live on the edge... *wink*)

This is useless AND annoying at the same time.

But people like us don't screw up our email address in the first place,
and if we do, we know how to fix it. Not everybody is like us.
 
C

Christophe

Steven D'Aprano a écrit :
But people like us don't screw up our email address in the first place,
and if we do, we know how to fix it. Not everybody is like us.

So you say that the better answer is not to teach them to be careful
when they fill those forms. It's to annoy them and teach them to
copy&paste mistakes instead!

Besides, what is so special with electronic forms that we have to go
through all kind of tricks to make sure the user doesn't make mistakes
when regular paper forms just assume the user will be careful when he
fills it? Must be some kind of IQ draining field emited by all the
computers which only computer experts are immune to :D
 
D

Diez B. Roggisch

Besides, what is so special with electronic forms that we have to go
through all kind of tricks to make sure the user doesn't make mistakes
when regular paper forms just assume the user will be careful when he
fills it? Must be some kind of IQ draining field emited by all the
computers which only computer experts are immune to :D

The speciality comes from paper forms being read by humans - or at least
that used to be the case. And as we still are more clever than your average
OCR program (and even than the not-so-average ones), that leads to
comparably good results.

But a computer that is supposed to process an electronic form - you have to
make sure to apply proper bondage techniques to make the user obey to your
command....

Diez
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top