Skip to content
المشاريع

mfbx9da4/deep-email-validator

عرض على GitHub

حول

يتحقق من صحة التعبيرات النمطية، ويرصد الأخطاء الإملائية وعناوين البريد المؤقتة، ويتحقق من DNS وSMTP.

الأنظمة والبنية التحتية

كيف تُقاس هذه الأرقام

النمو المقاس للنجوم

خلال 24 ساعة
٠
خلال 7 أيام
٠
خلال 15 يومًا
؜-١
خلال شهر
جارٍ جمع السجل

تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.

README.md

الأصل

deep-email-validator

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

  • Validates email format (contains @, . in domain, no spaces or control characters).
  • Validates common typos e.g. [email protected] using mailcheck.
  • Validates email was not generated by a 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.
  • Sanitizes inputs to prevent SMTP command injection.
  • Native TypeScript support.

Getting Started

Requires Node.js >= 20. Server-side only (not browser compatible).

Installation

npm install deep-email-validator

Usage

import { validate } from 'deep-email-validator'

const 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.",
//       }
//   }
// }

You can also pass an options object to control which validations run:

await validate({
  email: '[email protected]',
  sender: '[email protected]',
  validateRegex: true,
  validateMx: true,
  validateTypo: true,
  validateDisposable: true,
  validateSMTP: true,
})

Default options can be found here.

Custom TLDs

If you want to validate domains with TLDs that are not supported by default, use the additionalTopLevelDomains option:

await validate({
  email: '[email protected]',
  additionalTopLevelDomains: ['ir'],
})

For a list of TLDs supported by default, see mailcheck defaults.

CommonJS usage
const { validate } = require('deep-email-validator')

const res = await validate('[email protected]')

استكشف مشاريع مشابهة ومرتبطة

جارٍ التحميل…