A library written in Typescript which tries to validate if an email address really exists by connecting to the responsible email server.
npm install @sebastianfoth/email-address-existence --save
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>.
The email address wasn't found on the mail server
Invalid email address
Our identification method is blocked by the provider and/or your IP is blacklisted
Timeout while trying to connect to the email server
The email address might exists
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).
- I guess we need a licence
- Documentation
- Extend Options
- General cleanup
- Tests
- Input validation
- Building Process