diff --git a/lib/message-handler.js b/lib/message-handler.js index 088d52c9..08c3ca91 100644 --- a/lib/message-handler.js +++ b/lib/message-handler.js @@ -1456,12 +1456,13 @@ class MessageHandler { options = options || {}; subject = subject.replace(/\s+/g, ' ').trim(); + // `Re: [EXTERNAL] Re: Fwd: Example subject (fwd)` becomes `Example subject` if (options.removePrefix) { let match = true; while (match) { match = false; subject = subject - .replace(/^(re|fwd?)\s*:|\s*\(fwd\)\s*$/gi, () => { + .replace(/^(re|fwd?)\s*:|^\[.+?\](?=\s.+)|\s*\(fwd\)\s*$/gi, () => { match = true; return ''; })