Paul Rubin <no.email@nospam.invalid> writes: > Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> writes: > > Why do you want to write buggy code that makes your users hate your > > program? ... > > The only way to validate an email address is to ACTUALLY SEND AN EMAIL TO > > IT. > > Of course spamming people will make them hate you even more.
Use the email address without spamming, then. The point is that, having collected the email address, it's useless unless one actually uses it *as an email address*, by sending a message to it. Before then, “validating” it tells you nothing. > Insisting that people give you a valid email address (unless you have > a demonstrably legitimate use for it) is a variant of that. And matching it against a regex is going to either get it wrong (rejecting many valid email addresses), or be useless (accepting just about anything as “valid”). The test which matters is to use the value as an email address, by sending a message when the time comes to do that. -- \ “It's my belief we developed language because of our deep inner | `\ need to complain.” —Jane Wagner, via Lily Tomlin | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list