2 ms·
I used to work at Sendmail, and the people who literally wrote Sendmail, which had to understand every possible valid email, would always repeat this mantra: T
by jedberg 4y ago
I used to work at Sendmail, and the people who literally wrote Sendmail, which had to understand every possible valid email, would always repeat this mantra:
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.
- ComputerGuru 4y agoYeah, but sending emails that bounce via SES or any hosted service hurts your business because it lowers your trust rating. You are expected to filter crap from reaching their servers. "But @jedberg told me the only way I could know that foo!fu*k_your-momma"<>"123:hello@fuckyou.com is an invalid email was to send to it" won't fly.
- jedberg 4y agoObviously you have to take other precautions and not just blindly try to validate any email you get. But my point was you shouldn't reject an email only because it fails regex validation. 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.
- hooverd 4y agoYea, SES has a suppression list you manage that by default doesn't send. You can rig up an event bus to automatically add bounces to it.
- ComputerGuru 4y agoThe initial bounce still counts against it. (Also the suppression list isn’t set up automatically.)
- jedberg 4y ago> The initial bounce still counts against it No one knows that for sure, Amazon doesn't publish how they determine what counts against you. But from everything I've seen anecdotally, it does not. If you review the bounces and suppress the emails, it works just fine. Getting booted for bounces really only happens to high volume senders who are using scraped lists to send cold emails. And it's mostly the complaints that ruin your reputation, not the bounces.
- hooverd 4y agoPlus, if you spend enough to have a TAM you'll hear about it before anything bad happens.
- hooverd 4y agoAs long as your volume is high you can get away with the occasional bounce, especially if you add them to the SES exclusion list.