https://github.com/wyatt-herkamp/email_addresses_are_special
Information of Validating Email Addresses
https://github.com/wyatt-herkamp/email_addresses_are_special
Last synced: about 1 month ago
JSON representation
Information of Validating Email Addresses
- Host: GitHub
- URL: https://github.com/wyatt-herkamp/email_addresses_are_special
- Owner: wyatt-herkamp
- License: unlicense
- Created: 2023-11-26T17:24:10.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-26T17:51:34.000Z (over 1 year ago)
- Last Synced: 2025-01-27T13:50:31.966Z (3 months ago)
- Homepage:
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Email Addresses are Special
So you want to build an email address validator?
Here is some information that can be helpful.
## DO NOT USE REGEX
Regular Expressions are powerful however, it is truly the wrong tool for the job.
This is Perl's Regular Expression For [Email Validation](https://metacpan.org/release/RJBS/Email-Valid-1.200/source/lib/Email/Valid.pm#L390)
So as you can see to get a fully complete email validator is a messy process in Regex and I am assuming that the performance is not that great
## Emails are very permissive
For Example, These Are Some of my favorite valid emails
```text
// It is in between quotes and the characters are escaped
"very.(),:;<>[]\".VERY.\"very@\ \"very\".unusual"@strange.example.com
// Yes this is valid.
#!$%&'*+-/=?^_`{}|[email protected]
// Empty Space Between Quotes is allowed
" "@example.org
```## Implementing an Email Validator
If you decide to implement an email validator I recommend you read these resources first
- [RFC5322](https://datatracker.ietf.org/doc/html/rfc5322#section-3.4)
Then have a ton of tests. This Repository Contains some JSON files with tests to help you test your email validator.
Feel free to add more tests.
## Libraries that can do it for you
Find a Library to validate you because implementing it yourself is a mess
### Rust
- [Lettre](https://github.com/lettre/lettre)
- [mail_lib_types](https://github.com/nitro-mail/mail_lib/)Feel free to PR more libraries
### Thank You
[kenorb](https://stackoverflow.com/a/38787343) for their invalid and valid emails on StackOverFlow.