fix(email-validator): improve MX record validation and update project configuration

This commit is contained in:
2026-04-30 07:41:08 +00:00
parent 0885b139e9
commit 705ef9ce71
12 changed files with 2147 additions and 4153 deletions
+27
View File
@@ -0,0 +1,27 @@
{
"@git.zone/cli": {
"projectType": "npm",
"module": {
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartmail",
"description": "A unified format for representing and dealing with emails, with support for attachments and email validation.",
"npmPackagename": "@push.rocks/smartmail",
"license": "MIT",
"projectDomain": "push.rocks"
},
"release": {
"registries": [
"https://verdaccio.lossless.digital",
"https://registry.npmjs.org"
],
"accessLevel": "public"
}
},
"@git.zone/tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [license](./license) file.\n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH or third parties, and are not included within the scope of the MIT license granted herein.\n\nUse of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District Court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
},
"@ship.zone/szci": {
"npmGlobalTools": []
}
}
+2 -2
View File
@@ -2,8 +2,8 @@
"version": "0.2.0",
"configurations": [
{
"command": "npm test",
"name": "Run npm test",
"command": "pnpm test",
"name": "Run pnpm test",
"request": "launch",
"type": "node-terminal"
}
+5 -5
View File
@@ -1,17 +1,17 @@
{
"json.schemas": [
{
"fileMatch": ["/npmextra.json"],
"fileMatch": ["/.smartconfig.json"],
"schema": {
"type": "object",
"properties": {
"npmci": {
"@ship.zone/szci": {
"type": "object",
"description": "settings for npmci"
"description": "settings for ship.zone CI"
},
"gitzone": {
"@git.zone/cli": {
"type": "object",
"description": "settings for gitzone",
"description": "settings for git.zone CLI",
"properties": {
"projectType": {
"type": "string",
+7
View File
@@ -1,5 +1,12 @@
# Changelog
## 2026-04-30 - 2.2.1 - fix(email-validator)
improve MX record validation and update project configuration
- Destroy the smartdns client after MX lookups to avoid lingering resources
- Accept MX record values from either `value` or `exchange` fields and require at least one record for valid domains
- Update package metadata, build tooling, and replace `npmextra.json` with `.smartconfig.json`
## 2025-11-29 - 2.2.0 - feat(wire)
Add wire protocol, WireTarget & WireParser, Smartmail JSON serialization; refactor plugins and update dependencies
+3 -2
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) Lossless GmbH
Copyright (c) Task Venture Capital GmbH
Copyright (c) Romain SIMON
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -18,4 +18,5 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CON
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-35
View File
@@ -1,35 +0,0 @@
{
"npmci": {
"npmGlobalTools": [
"@git.zone/npmts",
"ts-node"
],
"npmAccessLevel": "public"
},
"gitzone": {
"projectType": "npm",
"module": {
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartmail",
"description": "A unified format for representing and dealing with emails, with support for attachments and email validation.",
"npmPackagename": "@push.rocks/smartmail",
"license": "MIT",
"keywords": [
"email handling",
"email validation",
"email formatting",
"typescript",
"email attachment",
"smartmail",
"email development",
"email template",
"disposable email detection",
"freemail detection"
]
}
},
"tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
}
}
+14 -11
View File
@@ -6,22 +6,22 @@
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"type": "module",
"author": "Lossless GmbH",
"license": "UNLICENSED",
"author": "Task Venture Capital GmbH",
"license": "MIT",
"scripts": {
"test": "(tstest test/ --verbose)",
"build": "(tsbuild tsfolders --allowimplicitany)",
"build": "tsbuild",
"buildDocs": "tsdoc"
},
"devDependencies": {
"@git.zone/tsbuild": "^3.1.2",
"@git.zone/tsrun": "^2.0.0",
"@git.zone/tstest": "^3.1.3",
"@types/node": "^22.15.14"
"@git.zone/tsbuild": "^4.4.0",
"@git.zone/tsrun": "^2.0.2",
"@git.zone/tstest": "^3.6.3",
"@types/node": "^25.6.0"
},
"dependencies": {
"@push.rocks/smartdns": "^7.6.1",
"@push.rocks/smartfile": "^13.0.1",
"@push.rocks/smartdns": "^7.9.0",
"@push.rocks/smartfile": "^13.1.3",
"@push.rocks/smartmustache": "^3.0.2",
"@push.rocks/smartpath": "^6.0.0",
"@push.rocks/smartrequest": "^5.0.1"
@@ -35,7 +35,7 @@
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
"npmextra.json",
".smartconfig.json",
"readme.md"
],
"browserslist": [
@@ -58,5 +58,8 @@
"type": "git",
"url": "https://code.foss.global/push.rocks/smartmail.git"
},
"packageManager": "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39"
"bugs": {
"url": "https://code.foss.global/push.rocks/smartmail/issues"
},
"packageManager": "pnpm@10.28.2"
}
+2072 -4085
View File
File diff suppressed because it is too large Load Diff
+6 -4
View File
@@ -530,19 +530,21 @@ interface IWireHandlers {
## License and Legal Information
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [license](./license) file.
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
### Trademarks
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH or third parties, and are not included within the scope of the MIT license granted herein.
Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.
### Company Information
Task Venture Capital GmbH
Registered at District court Bremen HRB 35230 HB, Germany
Registered at District Court Bremen HRB 35230 HB, Germany
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
For any legal inquiries or further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
+1 -1
View File
@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartmail',
version: '2.2.0',
version: '2.2.1',
description: 'A unified format for representing and dealing with emails, with support for attachments and email validation.'
}
@@ -101,7 +101,12 @@ export class EmailAddressValidator {
}
}
const result = await this.smartdns.getRecords(domain, 'MX');
let result: any;
try {
result = await this.smartdns.getRecords(domain, 'MX');
} finally {
this.smartdns.destroy();
}
if (this.options.cacheDnsResults) {
this.dnsCache.set(domain, { result, timestamp: Date.now() });
@@ -124,10 +129,7 @@ export class EmailAddressValidator {
// Extract exchange values from MX records
return mxRecords.map((record: any) => {
if (record && record.exchange) {
return record.exchange;
}
return '';
return record?.value || record?.exchange || '';
}).filter(Boolean);
}
@@ -221,9 +223,9 @@ export class EmailAddressValidator {
// Check MX records
const mxRecords = await this.checkMxRecords(domainPart);
result.mxValid = !!mxRecords;
result.mxValid = Array.isArray(mxRecords) && mxRecords.length > 0;
if (!mxRecords) {
if (!result.mxValid) {
result.reason = 'Domain does not have valid MX records';
return result;
}
+1 -1
View File
@@ -11,7 +11,7 @@
"outDir": "./dist_ts",
"rootDir": "./ts",
"strict": false,
"skipLibCheck": true
"noImplicitAny": true
},
"include": [
"ts/**/*"