Menu

Email validation in JavaScript: test your signup rules with mailrules
📰

Email validation in JavaScript: test your signup rules with mailrules

DEV Community: typescript·Rivier Grullon·about 16 hours ago
#QoiQWqL5
#devtotypescript#devto#dev#validator#example
Reading 0:00
15s threshold

I was asked to add stronger email validation to our forms at work. Honestly, I thought we were overcomplicating it at first.

Then I started looking into the details.

An email can have valid syntax and still come from a disposable provider. A signup form might need to reject certain domains, restrict access to a company, or flag shared addresses like support@ . Someone typing gmial.com probably needs a helpful suggestion.

Those decisions depend on the application. I wanted a way to define them once, inspect the result, and reuse the same policy across projects.

That is what I have been building with mailrules , an MIT-licensed email validation library for JavaScript and TypeScript.

The latest addition is a live playground .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.