-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch from isemail package to smtp-address-parser for more correct R…
…FC-5321 / RFC-6531 Mailbox address syntax check.
- Loading branch information
Gene Hightower
committed
Mar 17, 2021
1 parent
c56ec9a
commit 8956e4c
Showing
6 changed files
with
81 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
const { validate } = require('isemail'); | ||
const { parse } = require('smtp-address-parser'); | ||
|
||
module.exports = value => { | ||
return validate(value); | ||
try { | ||
parse(value); | ||
return true; | ||
} | ||
catch { | ||
return false; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,6 +99,7 @@ describe('load types', function() { | |
assert.ok(validate('квіточка@пошта.укр')); | ||
assert.ok(validate('Dörte@Sörensen.example.com')); | ||
assert.ok(validate('[email protected]')); | ||
assert.ok(validate('"John Doe"@example.com')); | ||
}); | ||
|
||
it('reject invalid idn-emails', function() { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters