2 ms·
If you happen to control the web page where the user is entering the email, this little piece of code has been a godsend for us: https://github.com/mailcheck/m
by tyingq 11y ago
If you happen to control the web page where the user is entering the email, this little piece of code has been a godsend for us:
https://github.com/mailcheck/mailcheck https://github.com/mailcheck/mailcheck
I agree with the idea that it's impossible to validate. But, mailcheck takes the approach of seeing if the email is potentially wrong, then prompting the user with what it thinks they meant. It's usually right, but if not, it allows whatever the user wants.
For example, if your user types in "user@gmil.con", it will suggest "user@gmail.com".
- thedufer 11y agoThis kind of stuff is great - make suggestions, but allow it to go through even if you think it's wrong. For the last email validation I worked on, there were only 2 absolute blockers - there must be an @ sign, and the domain must have MX records (emails that are technically valid remain useless if we can't send them anything). There were a number of other checks (being close to yahoo.com or gmail.com or other common email hosts, containing surprising characters, etc) that would trigger warnings, but still allow the check to pass if the user assured us it was correct.
- tyingq 11y ago>>domain must have MX records Technically, the RFC(5321) says MX records aren't required. You may be throwing out some small number of valid emails. "If an empty list of MXs is returned, the address is treated as if it was associated with an implicit MX RR with a preference of 0"