Skip to content

fix(mime-node): strip line breaks from multipart boundary material - #1867

Merged
andris9 merged 1 commit into
nodemailer:masterfrom
soroush5:fix/mime-boundary-line-breaks
Sep 11, 2026
Merged

andris9 merged 1 commit into
nodemailer:masterfrom
soroush5:fix/mime-boundary-line-breaks

Conversation

@soroush5

Copy link
Copy Markdown
Contributor

A CR or LF in baseBoundary, boundaryPrefix, or an explicit boundary parameter split the MIME delimiter lines while the declared boundary went out RFC2231-encoded, so the two sides never matched and receivers got an unparseable multipart body. The fix drops CR/LF where the boundary is assigned (constructor and _handleContentType), keeping declared and streamed boundaries identical.

Tests: two new build-level cases in test/mime-node/mime-node-test.ts (fail before, pass after). mime-node (181), mail-composer (62), and mailer (67) suites green, lint and typecheck green.

A CR or LF in baseBoundary, boundaryPrefix, or an explicit boundary parameter split the delimiter lines the tree is streamed with, while the declared boundary went out RFC2231-encoded. The two sides could never match again, so receiving clients saw an unparseable multipart body with the remainder of the boundary material as stray lines. Anything else is kept as is.
@andris9
andris9 merged commit 03c1a5c into nodemailer:master Sep 11, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants