nodemailer
Advanced tools
Comparing version 6.6.0 to 6.6.1
# CHANGELOG | ||
## 6.6.1 2021-05-23 | ||
- Fixed address formatting issue where newlines in an email address, if provided via address object, were not properly removed. Reported by tmazeika (#1289) | ||
## 6.6.0 2021-04-28 | ||
@@ -4,0 +8,0 @@ |
@@ -1150,5 +1150,5 @@ /* eslint no-undefined: 0, prefer-spread: 0, no-control-regex: 0 */ | ||
if (!address.name) { | ||
values.push(address.address); | ||
values.push(address.address.indexOf(' ') >= 0 ? `<${address.address}>` : `${address.address}`); | ||
} else if (address.name) { | ||
values.push(this._encodeAddressName(address.name) + ' <' + address.address + '>'); | ||
values.push(`${this._encodeAddressName(address.name)} <${address.address}>`); | ||
} | ||
@@ -1162,5 +1162,4 @@ | ||
} else if (address.group) { | ||
values.push( | ||
this._encodeAddressName(address.name) + ':' + (address.group.length ? this._convertAddresses(address.group, uniqueList) : '').trim() + ';' | ||
); | ||
let groupListAddresses = (address.group.length ? this._convertAddresses(address.group, uniqueList) : '').trim(); | ||
values.push(`${this._encodeAddressName(address.name)}:${groupListAddresses};`); | ||
} | ||
@@ -1179,3 +1178,6 @@ }); | ||
_normalizeAddress(address) { | ||
address = (address || '').toString().trim(); | ||
address = (address || '') | ||
.toString() | ||
.replace(/[\x00-\x1F<>]+/g, ' ') // remove unallowed characters | ||
.trim(); | ||
@@ -1187,2 +1189,3 @@ let lastAt = address.lastIndexOf('@'); | ||
} | ||
let user = address.substr(0, lastAt); | ||
@@ -1196,3 +1199,20 @@ let domain = address.substr(lastAt + 1); | ||
return user + '@' + punycode.toASCII(domain.toLowerCase()); | ||
let encodedDomain; | ||
try { | ||
encodedDomain = punycode.toASCII(domain.toLowerCase()); | ||
} catch (err) { | ||
// keep as is? | ||
} | ||
if (user.indexOf(' ') >= 0) { | ||
if (user.charAt(0) !== '"') { | ||
user = '"' + user; | ||
} | ||
if (user.substr(-1) !== '"') { | ||
user = user + '"'; | ||
} | ||
} | ||
return `${user}@${encodedDomain}`; | ||
} | ||
@@ -1199,0 +1219,0 @@ |
{ | ||
"name": "nodemailer", | ||
"version": "6.6.0", | ||
"version": "6.6.1", | ||
"description": "Easy as cake e-mail sending from your Node.js applications", | ||
@@ -34,3 +34,3 @@ "main": "lib/nodemailer.js", | ||
"libqp": "1.1.0", | ||
"mocha": "8.3.2", | ||
"mocha": "8.4.0", | ||
"nodemailer-ntlm-auth": "1.0.1", | ||
@@ -37,0 +37,0 @@ "proxy": "1.0.2", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
472949
11436