Skip to content

Commit 6bae600

Browse files
authored
fix: Fix produced text address list string according to rfc 2822 (#340)
1 parent a2ba9c2 commit 6bae600

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/mail-parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ class MailParser extends Transform {
10151015
.map(address => {
10161016
let str = '';
10171017
if (address.name) {
1018-
str += address.name + (address.group ? ': ' : '');
1018+
str += `"${address.name}"` + (address.group ? ': ' : '');
10191019
}
10201020
if (address.address) {
10211021
let link = address.address;

test/simple-parser-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module.exports['Parse message'] = test => {
2525
}
2626
],
2727
html: '<span class="mp_address_group"><span class="mp_address_name">Andris Reinman</span> &lt;<a href="mailto:[email protected]" class="mp_address_email">[email protected]</a>&gt;</span>, <span class="mp_address_group"><a href="mailto:[email protected]" class="mp_address_email">[email protected]</a></span>',
28-
text: 'Andris Reinman <[email protected]>, [email protected]'
28+
text: '"Andris Reinman" <[email protected]>, [email protected]'
2929
});
3030
test.done();
3131
});

0 commit comments

Comments
 (0)