valid-email-checker 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,129 @@
1
+ # Valid Email Checker
2
+
3
+ A comprehensive Node.js library for email validation and verification. Validates email format, detects temporary/disposable email addresses, and identifies spam patterns.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install valid-email-checker
9
+ ```
10
+
11
+ ## Features
12
+
13
+ - ✅ **Email Format Validation** - RFC 5322 compliant email format checking
14
+ - 🚫 **Temporary Email Detection** - Detects 1000+ disposable email domains
15
+ - 🛡️ **Spam Pattern Detection** - Identifies common spam email patterns
16
+ - 🔍 **MX Record Verification** - Optional DNS verification for domain validity
17
+ - ⚡ **Fast & Lightweight** - No external dependencies for core features
18
+
19
+ ## Usage
20
+
21
+ ### Basic Usage
22
+
23
+ ```javascript
24
+ const {
25
+ validateEmail,
26
+ isTemporaryEmail,
27
+ isSpamEmail,
28
+ fullValidation
29
+ } = require('valid-email-checker');
30
+
31
+ // Validate email format
32
+ const result = validateEmail('user@example.com');
33
+ console.log(result); // { valid: true, email: 'user@example.com' }
34
+
35
+ // Check for temporary/disposable email
36
+ const isTemp = isTemporaryEmail('user@tempmail.com');
37
+ console.log(isTemp); // { isTemporary: true, domain: 'tempmail.com', reason: 'Known disposable email domain' }
38
+
39
+ // Check for spam patterns
40
+ const isSpam = isSpamEmail('xxx123@example.com');
41
+ console.log(isSpam); // { isSpam: true, reasons: ['Contains suspicious patterns'] }
42
+
43
+ // Full validation (combines all checks)
44
+ const fullResult = fullValidation('user@example.com');
45
+ console.log(fullResult);
46
+ // {
47
+ // valid: true,
48
+ // email: 'user@example.com',
49
+ // isTemporary: false,
50
+ // isSpam: false,
51
+ // score: 100,
52
+ // details: { ... }
53
+ // }
54
+ ```
55
+
56
+ ### Async Validation with MX Record Check
57
+
58
+ ```javascript
59
+ const { validateEmailAsync } = require('valid-email-checker');
60
+
61
+ // Validates email and checks if domain has valid MX records
62
+ const result = await validateEmailAsync('user@example.com');
63
+ console.log(result);
64
+ // {
65
+ // valid: true,
66
+ // email: 'user@example.com',
67
+ // hasMxRecords: true,
68
+ // mxRecords: ['mx1.example.com', 'mx2.example.com']
69
+ // }
70
+ ```
71
+
72
+ ### Custom Configuration
73
+
74
+ ```javascript
75
+ const { EmailValidator } = require('valid-email-checker');
76
+
77
+ const validator = new EmailValidator({
78
+ allowPlusAddressing: false, // Reject emails with + addressing
79
+ checkMxRecords: true, // Enable MX record checking
80
+ customTempDomains: ['mytempdomain.com'], // Add custom temp domains
81
+ customSpamPatterns: [/^test\d+@/i], // Add custom spam patterns
82
+ });
83
+
84
+ const result = await validator.validate('user@example.com');
85
+ ```
86
+
87
+ ## API Reference
88
+
89
+ ### `validateEmail(email)`
90
+ Validates email format.
91
+ - **Returns:** `{ valid: boolean, email: string, error?: string }`
92
+
93
+ ### `isTemporaryEmail(email)`
94
+ Checks if email is from a disposable/temporary email service.
95
+ - **Returns:** `{ isTemporary: boolean, domain: string, reason?: string }`
96
+
97
+ ### `isSpamEmail(email)`
98
+ Checks if email matches spam patterns.
99
+ - **Returns:** `{ isSpam: boolean, reasons: string[] }`
100
+
101
+ ### `fullValidation(email)`
102
+ Performs complete validation combining all checks.
103
+ - **Returns:** `{ valid: boolean, email: string, isTemporary: boolean, isSpam: boolean, score: number, details: object }`
104
+
105
+ ### `validateEmailAsync(email)`
106
+ Validates email with MX record verification.
107
+ - **Returns:** `Promise<{ valid: boolean, email: string, hasMxRecords: boolean, mxRecords?: string[] }>`
108
+
109
+ ### `EmailValidator` Class
110
+ Create custom validator with specific configuration.
111
+
112
+ ## Score System
113
+
114
+ The `fullValidation` function returns a score from 0-100:
115
+ - **100**: Perfect - Valid format, not temporary, no spam patterns
116
+ - **70-99**: Good - Valid but has minor concerns
117
+ - **40-69**: Suspicious - May be temporary or has spam patterns
118
+ - **0-39**: Bad - Invalid or highly suspicious
119
+
120
+ ## Documentation
121
+
122
+ - [API Reference](docs/API.md) - Complete API documentation
123
+ - [Examples](docs/EXAMPLES.md) - Usage examples and recipes
124
+ - [Contributing](CONTRIBUTING.md) - How to contribute
125
+ - [Changelog](CHANGELOG.md) - Version history
126
+
127
+ ## License
128
+
129
+ MIT
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "valid-email-checker",
3
+ "version": "1.0.0",
4
+ "description": "Comprehensive email validation library - validates format, detects temporary/disposable emails, and identifies spam patterns",
5
+ "main": "src/index.js",
6
+ "types": "src/index.d.ts",
7
+ "scripts": {
8
+ "test": "node test/test.js",
9
+ "lint": "eslint src/"
10
+ },
11
+ "keywords": [
12
+ "email",
13
+ "validation",
14
+ "verify",
15
+ "temporary-email",
16
+ "disposable-email",
17
+ "spam",
18
+ "email-checker",
19
+ "temp-mail"
20
+ ],
21
+ "author": "",
22
+ "license": "MIT",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": ""
26
+ },
27
+ "engines": {
28
+ "node": ">=14.0.0"
29
+ },
30
+ "files": [
31
+ "src/"
32
+ ]
33
+ }