4 ms·
There is exactly one right way to validate an email address: Send an email to it. It makes a lot of sense to have a good regex that validates it on the fronte
by jedberg 5y ago
There is exactly one right way to validate an email address: Send an email to it.
It makes a lot of sense to have a good regex that validates it on the frontend and even tells the user, "hey, this doesn't look valid, are you sure?" but don't ever reject someone for failing your regex.
At the end of the day, you should only validate by having them click on a link in their email. Then you know the whole thing works.
If you're worried about someone hurting your reputation with a bunch of bad email addresses, you can certainly mitigate that by rate limiting your signup API or even deprioritizing sending confirmation emails to email addresses that don't look valid. But you still should eventually send an email to make sure it's valid and not reject it until it bounces back.