https://github.com/mfbx9da4/deep-email-validator
Validates regex, typos, disposable, dns and smtp
https://github.com/mfbx9da4/deep-email-validator
email-validation email-validator smtp
Last synced: 7 days ago
JSON representation
Validates regex, typos, disposable, dns and smtp
- Host: GitHub
- URL: https://github.com/mfbx9da4/deep-email-validator
- Owner: mfbx9da4
- License: mit
- Created: 2020-03-07T17:24:17.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2025-03-28T04:58:39.000Z (about 2 months ago)
- Last Synced: 2025-05-13T10:58:58.289Z (7 days ago)
- Topics: email-validation, email-validator, smtp
- Language: TypeScript
- Homepage:
- Size: 564 KB
- Stars: 887
- Watchers: 17
- Forks: 98
- Open Issues: 52
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Email Validator
Validates email addresses based on regex, common typos, disposable email blacklists, DNS records and SMTP server response.
- Validates email looks like an email i.e. contains an "@" and a "." to the right of it.
- Validates common typos e.g. [email protected] using [mailcheck](https://github.com/mailcheck/mailcheck).
- Validates email was not generated by disposable email service using [disposable-email-domains](https://github.com/ivolo/disposable-email-domains).
- Validates MX records are present on DNS.
- Validates SMTP server is running.
- Validates mailbox exists on SMTP server.
- Native typescript support.## Getting Started
Compatible with nodejs only. Not browser ready.
Install like so
```
npm i deep-email-validator --save
```or with yarn
```
yarn add deep-email-validator
```Use like so
```typescript
import { validate } from 'deep-email-validator'
const main = async () => {
let res = await validate('[email protected]')
// {
// "valid": false,
// "reason": "smtp",
// "validators": {
// "regex": {
// "valid": true
// },
// "typo": {
// "valid": true
// },
// "disposable": {
// "valid": true
// },
// "mx": {
// "valid": true
// },
// "smtp": {
// "valid": false,
// "reason": "Mailbox not found.",
// }
// }
// }// Can also be called with these default options
await validate({
email: '[email protected]',
sender: '[email protected]',
validateRegex: true,
validateMx: true,
validateTypo: true,
validateDisposable: true,
validateSMTP: true,
})
}
```If you want to validate domains with TLDs that are not supported by default, you can use `additionalTopLevelDomains` option:
```typescript
await validate({
email: '[email protected]',
sender: '[email protected]',
validateRegex: true,
validateMx: true,
validateTypo: true,
validateDisposable: true,
validateSMTP: true,
additionalTopLevelDomains: [ 'ir' ]
})
```
For a list of TLDs that are supported by default you can see [here](https://github.com/mailcheck/mailcheck/blob/afca031b4ce1cdc6e3ecbe88198f41b4835f81e3/src/mailcheck.js#L31).##
[Default options can be found here](https://github.com/mfbx9da4/deep-email-validator/blob/8bbd9597a7ce435f0a77889a45daccdd5d7c3488/src/options/options.ts#L1)