4 ms·
There is no point in many cases. Even if you can verify that the email address is syntactically valid, you'll still need to check that it was not mistyped, and
by hutrdvnj 5y ago
There is no point in many cases. Even if you can verify that the email address is syntactically valid, you'll still need to check that it was not mistyped, and that it actually goes to the person you think it does. The only way to do that is to send them an email and have them click a link to verify.
However, if you still want to validate an email address then use a library. All popular programming languages have email validation libraries. Yes, it's an extra dependency if it's not included in the std lib or the framework you use, but email validation is wrong in 99% of the cases, if you wrote it yourself.
- yawaramin 5y agoOr use the browser. HTML form validation has <input type="email"> which checks that the entry is a valid email address.
- mikl 5y agoNot quite, browsers have slightly different implementations here, we recently had to stop using this because we had customers using IDN e-mails like hansi@lübeck.de and this would fail validation in some browsers (but not others).
- yawaramin 5y agoInteresting. Got a bug report I can track for those browsers?