@sebastianfoth/email-address-existence
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -48,5 +48,5 @@ "use strict"; | ||
const resolveMx = util_1.promisify(this.dns.resolveMx); | ||
const addresses = yield resolveMx(domain); | ||
const sortedAddresses = addresses.sort((a, b) => a.priority - b.priority); | ||
return sortedAddresses[0].exchange; | ||
const addressesMx = yield resolveMx(domain); | ||
const sortedAddressesMx = addressesMx.sort((a, b) => a.priority - b.priority); | ||
return sortedAddressesMx[0].exchange; | ||
}); | ||
@@ -74,2 +74,3 @@ } | ||
conn.write('QUIT' + EOL); | ||
/* */ | ||
conn.on('data', data => { | ||
@@ -76,0 +77,0 @@ const response = data.toString().trim(); |
{ | ||
"name": "@sebastianfoth/email-address-existence", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Checks if an email address exists", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -0,4 +1,52 @@ | ||
# About | ||
A library written in Typescript which tries to validate if an email address really exists by connecting to the responsible email server. | ||
# How to install | ||
`npm install @sebastianfoth/email-address-existence --save` | ||
# Usage | ||
# Usage / Howto | ||
``` | ||
import { EmailAddressExistenceService, EmailValidationStatus } from '@sebastianfoth/email-address-existence'; | ||
const service = new EmailAddressExistenceService(); | ||
const result = await service.validate({ | ||
recipient: 'MAIL_ADDRESS_TO_CHECK_FOR_EXISTENCE', | ||
sender: 'YOUR_MAIL_ADDRESS', | ||
timeout: 3000, | ||
portTelnet: 25, | ||
debug: true, | ||
}); | ||
if (result === EmailValidationStatus.MAY_EXISTS) { | ||
// Yay, the address might exists | ||
} | ||
``` | ||
The method validate() returns Promise<EmailValidationStatus>. | ||
## Possible values of EmailValidationStatus | ||
### EmailValidationStatus.NOT_FOUND | ||
The email address wasn't found on the mail server | ||
### EmailValidationStatus.INVALID_SYNTAX | ||
Invalid email address | ||
### EmailValidationStatus.BLOCKED_BY_PROVIDER | ||
Our identification method is blocked by the provider and/or your IP is blacklisted. | ||
### EmailValidationStatus.TIMEOUT | ||
Timeout while trying to connect to the email server | ||
### EmailValidationStatus.MAY_EXISTS | ||
The email address might exists | ||
# Caveats | ||
Email providers know how to protect their users, please keep the following things in mind: | ||
* Some email servers might always say that the specific email address exists | ||
* Some email servers might always say that the specific email address doesn't exist | ||
* Some email servers block your IP in case you perform too many queries | ||
Please keep the things mentioned above in mind in case you are using this library. Always try to revalidate the responses by checking addresses you are aware they exist and also do the opposite: Check for addresses which unlikely exist by choosing a random string as username (i.e. jhuihgiuwehiugwh@gmail.com). | ||
# TODOs | ||
* I guess we need a licence | ||
* Documentation | ||
* Extend Options | ||
* General cleanup | ||
* Tests |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11625
195
53