this post was submitted on 09 Feb 2024
92 points (89.0% liked)
Programming
17270 readers
39 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Amen.
Spoiler alert: Few of them are good, and those few are so simple that you might as well not use a library.
The only way to correctly validate an email address is to send a message to it, and verify that it arrived.
You can use a regex to do basic validation. That regex is
.+@.+
. Anything beyond that is a waste of time.There are also cases where you want to have a disallow list of known bad email providers. That’s also part of the parsing and validating.
Imagine giving someone your phone number, and having them say you have to get a different one because they don't like some of the digits in it.
I have seen this nonsense more times than I care to remember. Please don't build systems this way.
If you're trying to do bot detection or the like, use a different approach. Blacklisting email addresses based on domain or any other pattern does a poor job of it and creates an awful user experience.
(And if it prevents people from using spam-fighting tools like forwarding services, then it's directly user-hostile, and makes the world a worse place.)