email-validator-ultimate
Version:
Advanced email validator ultimate library for Node.js. Includes format checks, MX records, SMTP inbox validation, disposable email detection, and quality scoring. email validation email validator
144 lines (102 loc) โข 4.29 kB
Markdown
# ๐ง email-validator-ultimate
A powerful Node.js email validation library that goes beyond regex.
Performs DNS/MX record checks, SMTP deliverability tests, disposable email detection, and more.
## โ ๏ธ Important
If you want to check if an email inbox exists (SMTP/bounce check), make sure:
- Your server **allows outbound port 25** (many hosts block it by default).
- You provide a **valid `fromEmail` sender** (e.g., `noreply@yourdomain.com`).
- **SMTP check is optional** and **disabled by default**.
## ๐ง Features
- โ
**Format validation** (RFC-compliant)
- ๐ฎ **MX record lookup**
- โ๏ธ **SMTP inbox existence check** _(optional)_
- ๐ซ **Disposable email detection**
- ๐ค **Generic username detection** (e.g., `admin`, `info`)
- ๐ผ **Provider and domain info**
- ๐ข **Email quality scoring**
- ๐ **Free email provider detection** (e.g., Gmail, Yahoo)
- ๐ก **Catch-all detection** _(optional)_
## ๐ฆ Installation
```bash
npm install email-validator-ultimate
```
## ๐ฆ Installation
Basic Example (ESM)
```bash
import { validateEmail } from 'email-validator-ultimate';
const result = await validateEmail({
email: 'someone@example.com',
fromEmail: 'noreply@yourdomain.com',
smtpCheck: true, // Enable SMTP validation (optional)
debug: true // Optional SMTP debug logs
});
console.log(result);
```
Using with Express (CommonJS)
```bash
const { validateEmail } = require('email-validator-ultimate');
app.post('/validate', async (req, res) => {
const result = await validateEmail({
email: req.body.email,
fromEmail: 'noreply@yourdomain.com',
smtpCheck: true
});
res.json(result);
});
```
## โ
Validation Result Example
```bash
{
"email": "someone@example.com",
"username": "someone",
"domain": "example.com",
"formatValid": true,
"hasMX": true,
"isDisposable": false,
"isGeneric": false,
"isFree": false,
"provider": "Example",
"mxRecord": "mx1.example.com",
"canReceiveEmail": {
"smtpSuccess": true,
"message": "SMTP verification passed",
"catchAll": false
},
"qualityScore": 92
}
```
## ๐งช Options
| Option | Type | Required | Description |
| :-------- | :-----: | :------: | :--------------------------------------- |
| email | string | โ
| Email address to validate |
| fromEmail | string | โ
| Email sender used for SMTP (if enabled) |
| smtpCheck | boolean | โ | Enable SMTP inbox check (default: false) |
| debug | boolean | โ | Log SMTP conversation to console |
## ๐ค Contributing
Contributions are welcome! Whether it's reporting bugs, suggesting features, or submitting pull requests, your help is appreciated.
Please follow these guidelines:
- Fork the repository and create your branch (`git checkout -b feature/your-feature`)
- Commit your changes (`git commit -m 'Add some feature'`)
- Push to the branch (`git push origin feature/your-feature`)
- Open a pull request describing your changes
Make sure your code passes all tests and adheres to the existing style.
## ๐ License
This project is licensed under the MIT License โ see the [LICENSE] file for details.
ยฉ 2025
## โ๏ธ Author
**Mehedi Hasan**
๐ง [aminulislamdev23@gmail.com](mailto:aminulislamdev23@gmail.com)
๐ [GitHub](https://github.com/ai-mehedi)
## ๐ Keywords
[Email validation](https://www.google.com/search?q=email+validation) ยท
[SMTP check](https://www.google.com/search?q=SMTP+check) ยท
[Disposable email detection](https://www.google.com/search?q=disposable+email+detection) ยท
[MX record lookup](https://www.google.com/search?q=MX+record+lookup) ยท
[Catch-all detection](https://www.google.com/search?q=catch-all+detection) ยท
[Email format validation](https://www.google.com/search?q=email+format+validation) ยท
[Node.js email validator](https://www.google.com/search?q=node.js+email+validator) ยท
[Email quality scoring](https://www.google.com/search?q=email+quality+scoring) ยท
[Generic username detection](https://www.google.com/search?q=generic+username+detection)