@bobfrankston/iflow-direct 0.1.40 → 0.1.41
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/imap-protocol.js +19 -3
- package/package.json +1 -1
package/imap-protocol.js
CHANGED
|
@@ -399,9 +399,25 @@ function parseAddressList(token) {
|
|
|
399
399
|
const parts = tokenizeParenList(group);
|
|
400
400
|
if (parts.length >= 4) {
|
|
401
401
|
const name = decodeImapString(unquote(parts[0]));
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
402
|
+
let mailbox = unquote(parts[2]);
|
|
403
|
+
let host = unquote(parts[3]);
|
|
404
|
+
// Dovecot stamps "MISSING_MAILBOX" / "MISSING_DOMAIN" into the
|
|
405
|
+
// ENVELOPE tuple when the source From: header didn't parse cleanly
|
|
406
|
+
// (RFC 3501 forbids NIL in those slots when any address part is
|
|
407
|
+
// present). Strip the sentinels so we don't render
|
|
408
|
+
// "user@iecc.com@MISSING_DOMAIN" — observed in the wild from
|
|
409
|
+
// Outlook's malformed `From: "name" <"local@domain">` over-quoting.
|
|
410
|
+
if (host === "MISSING_DOMAIN")
|
|
411
|
+
host = "";
|
|
412
|
+
if (mailbox === "MISSING_MAILBOX")
|
|
413
|
+
mailbox = "";
|
|
414
|
+
// Recover from Outlook's quoted-string pathology: when the local
|
|
415
|
+
// part itself contains an "@" the entire mailbox value is already
|
|
416
|
+
// a full address, so don't append @host again. Same hand applies
|
|
417
|
+
// to any server that mis-parses an over-quoted From header.
|
|
418
|
+
const address = mailbox.includes("@")
|
|
419
|
+
? mailbox
|
|
420
|
+
: (mailbox && host ? `${mailbox}@${host}` : mailbox || "");
|
|
405
421
|
addrs.push({ name, address });
|
|
406
422
|
}
|
|
407
423
|
}
|