What does HackerNews think of mailcheck?

Reduce misspelled email addresses in your web apps.

Language: JavaScript

Not an "instead of" approach, but the best thing I'd implemented when running an ecom site was a typo detector that prompted people to fix their email if it looked wrong, like "[email protected]", "Did you mean [email protected]?".

At the time I used "mailcheck": https://github.com/mailcheck/mailcheck

There appears to be a more modern implementation here: https://github.com/ZooTools/email-spell-checker

It reduced the amount of badly entered emails more than any other approach I tried.

It misses the very common mistake of typing a comma instead of a dot.

Otherwise, yeah, most people would be better served by a library that detects domain typos like https://github.com/mailcheck/mailcheck than spending time on regexes.

OP has shared a solution for typo fix in the closing remarks of the blog: https://github.com/mailcheck/mailcheck
The most helpful thing I've used in the real world is something that looks for common typographical errors, even if the email is technically valid.

Like, if the user types "[email protected]", it pops a dialogue asking "Did you mean [email protected]?". But lets them keep what they typed, or do a different fix if needed.

I found some JS called "mailcheck": https://github.com/mailcheck/mailcheck

I assume it's using popularity statistics, edit distance, etc, to come up with suggestions. There are updated clones that use react, vue, etc, instead of jquery.

With a working ecommerce site, this improved the percentage of correct emails more than anything else I tried, and I had tried many things. Because it's a bad situation when you've taken someone's money and have nothing other than a shipping address to contact them if something goes wrong (bad shipping address, out of stock situation, etc).

Mailcheck is also helpful to catch things like "[email protected]" and other common typos when the user types it in:

https://github.com/mailcheck/mailcheck

Fork modified for React: https://github.com/eligolding/react-mailcheck#readme

I recently implemented this using the great Mailcheck library. So if someone types "gnail.com" or "gmail.con" it detects it and we can show "Did you mean gmail.com?". If someone ignores the suggestion, fair enough. If someone purposely wants to give us a junk email, fair enough. At least we're not frustrating them needlessly.

https://github.com/mailcheck/mailcheck

I suppose it depends on what we mean by validate. Running an ecommerce site, I got a lot of mileage out of prompting the customer to fix emails that "looked wrong". We allowed them to proceed if they wanted. A really common one was "[email protected]" when "[email protected]" was wanted. We used a slightly modified version of https://github.com/mailcheck/mailcheck and found it to be really useful.
It does work well. I used a customized version of https://github.com/mailcheck/mailcheck on an ecomm website and the amount of bounces due to typos went way down.

It is important to tune it a bit based on what you see after installing it to reduce the amount of bad suggestions.

I use this library for web pages that ask for an email: https://github.com/mailcheck/mailcheck

It's a bit old and requires jquery, but it's fairly easy to gut the library and just use the email logic. It even uses your example of "gnail.com" in the README.

I like the approach of accepting anything that is a reasonable length with an`@`, but suggestinging corrections for possibly misspelled common domains.

https://github.com/mailcheck/mailcheck

If you really need to validate, the only way I know how is to send them an email and click a link to confirm.

mailcheck [1] is great for this, especially when supplemented with your users' most popular email domains.

[1] https://github.com/mailcheck/mailcheck

One thing I've found that helps a lot is instant delivery notifications. When you try to register a new account, our "We've sent a confirmation email" screen will report within a few seconds if there was a mail delivery error and allow the user to correct their address. Common typo detection for popular email domains is also beneficial (https://github.com/mailcheck/mailcheck)
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

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 "[email protected]", it will suggest "[email protected]".

I think many people are thinking about email address validation the wrong way.

RFC 822 describes how messages are encoded when email servers talk to each other. It isn't really about email address validation and is not intended to be used to validate a form field on some registration page.

Unless you're writing an MTA or similar piece of infrastructure there is no reason you should be using the RFC grammar. Even if implementation were easy, it probably isn't what you want. For example, the spec permits inline comments but that's a nonsensical thing to have in the middle of an address you typed into an HTML form. Email addresses entered on a web form should be rejected if they contain comments, IMHO.

I think what most developers really want to know is something like: Can this given email address receive messages? Or: Does this given address actually belong to this user? Well, the only way to test that is to send it a message. At best, regex validation might warn you earlier that a given address couldn't possibly work because it's so obviously malformed. But you can't validate your way into getting people to enter their real email address if they don't want to or if they don't know what it is. If your intent is really just to help catch typos and mistakes, you'd be much better off looking to something like mailcheck [0] which will flag common typos like "[email protected]" even if they result in valid looking addresses.

[0] https://github.com/mailcheck/mailcheck

Alternatively, don't validate email addresses with a regex because it's pointless. Check that at least an '@' symbol is present and just send a damn email already[0]. Or better, don't send a damn email at all and let them access it because it's pointless to have an extra verification step.

If you really want to do some clientside validation, just keep a basic regex and warn the user if the address doesn't seem right.. Or use MailCheck[1].

0. http://davidcel.is/blog/2012/09/06/stop-validating-email-add...

1. https://github.com/mailcheck/mailcheck