New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

swipe-email-validator

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swipe-email-validator

Validates emails based on regex, common typos, disposable email blacklists, DNS records and SMTP server response.

  • 0.1.26
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

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. example@gmaill.com using mailcheck.
  • Validates email was not generated by disposable email service using 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 swipe-email-validator --save

or with yarn

yarn add swipe-email-validator

Use like so

import { validate } from 'swipe-email-validator'
const main = async () => {
  let res = await validate('asdf@gmail.com')
  // {
  //   "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: 'name@example.org',
    sender: 'name@example.org',
    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:

await validate({
  email: 'name@example.ir',
  sender: 'name@example.ir',
  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.

Default options can be found here

Keywords

FAQs

Package last updated on 22 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc