I'll save everyone the trouble and skip ahead to the anti-climactic end to
the email validation problem: you can't.
You can filter blatantly invalid email addresses (but do not go strictly
from the RFC, because some very weird emails end up being valid regardless).
You can resolve hosts.
You can send a probe.
You can develop a parrellel-process tri-layer error corrected neural-network
driven logic filter.
You can ask nicely.
You can ask nicely twice.
You can beg and plead and threaten and pout.
But you can't be sure.
The way I do my email validation is inform the user that if they don't give
a valid email they can't activate their account. I send them an email
without doing much of anything in the way of parsing their address. I
include a url which they need only visit in their browser to confirm their
account.
But you know what? No matter how clearly I tell them that they can't
activate their account without a valid email, that doesn't stop them from
giving a clearly invalid email address. Go figure.
The answer comes down to "don't even bother to be clever". It will just
slowly drive you insane.
So the moral of the story is: verify, verify, verify.
--
Plutarck
Should be working on something...
...but forgot what it was.
"Szii" <[EMAIL PROTECTED]> wrote in message
003801c0cd06$30d46e60$[EMAIL PROTECTED]">news:003801c0cd06$30d46e60$[EMAIL PROTECTED]...
> Actually, you can check the validity of the SMTP port to semi-validate the
> domain. The name of the recipient would be harder, but again, through
> your standard "user does not exist" error messages/codes, you could
> tell if the domain is valid, but the user is not.
>
> Checking to see if it's "syntactically correct" is trivial. Validating
the
> domain
> is rather simple as well (check the retcode on a whois lookup.)
Validating
> the user would require interpretation of the return mail message(s).
>
> Again, it's not "real-time" validation of anything except the
> existance/validity
> of the domain - not the user.
>
> 'Luck
>
> -Szii
>
>
> ----- Original Message -----
> From: "christopher hamilton" <[EMAIL PROTECTED]>
> To: "Martin Skjoldebrand" <[EMAIL PROTECTED]>;
> <[EMAIL PROTECTED]>
> Sent: Tuesday, April 24, 2001 1:39 PM
> Subject: RE: [PHP] checking if e-mail address and syntax are valid
>
>
> >
> > I'd like to add to that, before someone spends a lifetime searching for
an
> > answer ...
> >
> > "Solution: There isn't one. You cannot do real-time validation of mail
> > addresses. You must pick from a number of compromises."
> >
> > The section goes on describing how many RFC-valid addresses are
> > undeliverable and on the opposite side of the coin, some RFC-invalid
> > addresses are perfectly deliverable.
> >
> > "Our best advice for verifying a person's mail address is to have them
> enter
> > their address twice, just as you would when changing a password."
> >
> > - Chris
> >
> > > > I would like to know if anyone has or know any PHP code to verify if
a
> > > > form entered e-mail address is valid?
> > > >
> > > > I would like that things like 4$%^%$@@.com.br could not be sent. I
> only
> > > > has to verify the syntax of it, the existance I believe should be
> harder
> > > > to verify but if it is possible I would be glad if anyone could
point
> me
> > > > the way.
> > >
> > > This is taken from PHP Developers Cookbook. Don't ask me exactly what
it
> > > does, because I don't know. I think I can grasp the basics of it
though.
>
> > > It isn't fool proof tho.
> > >
> > >
> > > if (!eregi ("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$",
> > > $users)) die ("Invalid email");
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]