You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(gmail): forward original attachments and preserve inline images (#589)
Include original message attachments on +forward by default, matching
Gmail web behavior. Add --no-original-attachments flag to opt out
(skips file attachments but preserves inline images in HTML mode).
Preserve cid: inline images in HTML mode for both +forward and
+reply/+reply-all by building the correct multipart/related MIME
structure via mail-builder's MimePart API. Gmail's API rewrites
Content-Disposition: inline to attachment in multipart/mixed, so
explicit multipart/related is required.
In plain-text mode, inline images are not included for both forward
and reply, matching Gmail web behavior.
Key implementation details:
- Single-pass MIME payload walker replaces separate text/html extractors
- OriginalPart metadata type with lazy attachment data fetching
- Part classification uses Content-Disposition to distinguish regular
attachments from inline images (some clients set Content-ID on both)
- Content-ID and content_type sanitized against CRLF header injection
- Size preflight before downloading original attachments
- Remote filename sanitization (not rejection) for sender-controlled names
- Walker does not recurse into hydratable parts (e.g., message/rfc822)
- Includes the original message with sender, date, subject, and recipients.
53
-
- Use -a/--attach to add file attachments. Can be specified multiple times.
55
+
- Original attachments are included by default (matching Gmail web behavior).
56
+
- With --html, inline images are also preserved via cid: references.
57
+
- In plain-text mode, inline images are not included (matching Gmail web).
58
+
- Use --no-original-attachments to forward without the original message's files.
59
+
- Use -a/--attach to add extra file attachments. Can be specified multiple times.
60
+
- Combined size of original and user attachments is limited to 25MB.
54
61
- With --html, the forwarded block uses Gmail's gmail_quote CSS classes and preserves HTML formatting. Use fragment tags (<p>, <b>, <a>, etc.) — no <html>/<body> wrapper needed.
55
-
- With --html, inline images in the forwarded message (cid: references) will appear broken. Externally hosted images are unaffected.
- The command fails if no To recipient remains after exclusions and --to additions.
59
59
- Use -a/--attach to add file attachments. Can be specified multiple times.
60
60
- With --html, the quoted block uses Gmail's gmail_quote CSS classes and preserves HTML formatting. Use fragment tags (<p>, <b>, <a>, etc.) — no <html>/<body> wrapper needed.
61
-
- With --html, inline images in the quoted message (cid: references) will appear broken. Externally hosted images are unaffected.
61
+
- With --html, inline images in the quoted message are preserved via cid: references.
- Use -a/--attach to add file attachments. Can be specified multiple times.
56
56
- With --html, the quoted block uses Gmail's gmail_quote CSS classes and preserves HTML formatting. Use fragment tags (<p>, <b>, <a>, etc.) — no <html>/<body> wrapper needed.
57
-
- With --html, inline images in the quoted message (cid: references) will appear broken. Externally hosted images are unaffected.
57
+
- With --html, inline images in the quoted message are preserved via cid: references.
0 commit comments