by jedberg · 3y ago · 0 comments
There is exactly one way to validate an email address, and that is to send it an email.
No matter what regex you use, you will be wrong. Sure, use the 800 line regex to do a pre-validation and ask the user "are you sure this is correct?" if it fails, but let them use it anyway if they click yes, because it might just be valid.
Then send it an email and if it bounces or they don't click the verification link, move on and delete it.
Also, those services don't ding you if you get a single bounce from a new email. They only start penalizing you if you repeatedly send to the same email and it bounces. You could always put checks in place to store previously failed email addresses.
And if your business is generating a bunch of take signups, it sounds like you need to put some rate limits on your sign up page.
And of course that's not deliverable, you can't use a : outside of a quoted part. :) But that is actually a perfect example of why you can't use a regex. Maybe they modified their mail server to accept it.