Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Because the domain name doesn't need to be fully-qualified; it can just be a machine name on the local network.

To illustrate this: "user@localhost" is a valid email address.

All these overly complex regular expressions miss a major point: even if the e-mail address is valid according to the RFC it doesn't guarantee that:

  * The domain name exists.
  * The user exists at the specified domain.
  * All of the SMTP servers between you and the recipient adhere exactly to the RFC.
  * The user actually owns or has access to the e-mail account in question.
Whenever I need to validate an e-mail address, I just use something simple like ".+@.+" to ensure sanity and move on to more pressing matters. As a friend once pointed out to me: it's usually far more damaging to reject valid e-mail addresses than to accept invalid ones; be liberal in what you accept and verify the e-mail address by sending them a confirmation mail.


Yes, especially websites should accept more than [a-zA-Z0-9] for the user part. This would allow filtering emails. E.g. gmails can tag emails this way: john.doe+spam@gmail.com




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: