feat: add "Forward as attachment" next to Export as .eml

Adds a "Forward as attachment" action to the message overflow menu
(desktop and mobile), right beside the existing "Export as .eml"
action. Opens a new forward-mode compose window with the original
message attached as a message/rfc822 file instead of quoted inline -
useful for reporting spam/phishing to an upstream gateway that expects
the raw original as an attachment (the primary motivating use case:
gateways like MxGuarddog require complete original headers, including
the full mail path, for scanning), or for preserving a message's exact
formatting/headers when forwarding.

Implementation reuses the composer's existing attachment-carry-forward
mechanism (the `attachments` useState initializer in
email-composer.tsx already carries a forwarded message's own
attachments into the new compose via `replyTo.attachments`) - this
just adds one synthetic entry representing the whole original message,
referenced by its existing blobId. No re-fetch or re-upload needed,
since JMAP blobs are account-scoped rather than per-email. The inline
quote-header step (prepareComposerQuoteHeader) is skipped, so the body
starts blank instead of quoting the original.

The core "build subject + attachment entry" logic is extracted into a
pure, unit-tested helper (lib/forward-as-attachment.ts) rather than
left inline in the already-large page component.

Adds the forward_as_attachment locale key to all 24 locales (English
text as a placeholder pending translation, following the existing
add-a-key convention) to satisfy the translations completeness test.
This commit is contained in:
Aaron Guise
2026-07-27 15:31:52 +12:00
parent 9c04950a94
commit 3ea22161d9
28 changed files with 186 additions and 0 deletions
+1
View File
@@ -298,6 +298,7 @@
"print": "طباعة",
"view_source": "عرض المصدر",
"export_email": "تصدير كملف .eml",
"forward_as_attachment": "Forward as attachment",
"import_email": "استيراد ملف .eml أو .zip",
"keyboard_shortcuts": "اختصارات لوحة المفاتيح (؟)",
"email_source": "مصدر الرسالة",
+1
View File
@@ -298,6 +298,7 @@
"print": "Imprimeix",
"view_source": "Mostra el codi font",
"export_email": "Exporta com a .eml",
"forward_as_attachment": "Forward as attachment",
"import_email": "Importa .eml o .zip",
"keyboard_shortcuts": "Dreceres de teclat (?)",
"email_source": "Codi font del correu",
+1
View File
@@ -298,6 +298,7 @@
"print": "Tisk",
"view_source": "Zobrazit zdrojový kód",
"export_email": "Exportovat jako .eml",
"forward_as_attachment": "Forward as attachment",
"import_email": "Importovat .eml nebo .zip",
"keyboard_shortcuts": "Klávesové zkratky (?)",
"email_source": "Zdrojový kód zprávy",
+1
View File
@@ -298,6 +298,7 @@
"print": "Udskriv",
"view_source": "Vis kilde",
"export_email": "Eksportér som .eml",
"forward_as_attachment": "Forward as attachment",
"import_email": "Importér .eml eller .zip",
"keyboard_shortcuts": "Tastaturgenveje (?)",
"email_source": "E-mail-kilde",
+1
View File
@@ -298,6 +298,7 @@
"print": "Drucken",
"view_source": "Quelltext anzeigen",
"export_email": "Als .eml exportieren",
"forward_as_attachment": "Forward as attachment",
"import_email": ".eml oder .zip importieren",
"keyboard_shortcuts": "Tastaturkürzel (?)",
"email_source": "E-Mail-Quelltext",
+1
View File
@@ -298,6 +298,7 @@
"print": "Print",
"view_source": "View source",
"export_email": "Export as .eml",
"forward_as_attachment": "Forward as attachment",
"import_email": "Import .eml or .zip",
"keyboard_shortcuts": "Keyboard shortcuts (?)",
"email_source": "Email Source",
+1
View File
@@ -298,6 +298,7 @@
"print": "Imprimir",
"view_source": "Ver código fuente",
"export_email": "Exportar como .eml",
"forward_as_attachment": "Forward as attachment",
"import_email": "Importar .eml o .zip",
"keyboard_shortcuts": "Atajos de teclado (?)",
"email_source": "Código Fuente del Correo",
+1
View File
@@ -298,6 +298,7 @@
"print": "چاپ",
"view_source": "مشاهده منبع",
"export_email": "خروجی .eml",
"forward_as_attachment": "Forward as attachment",
"import_email": "وارد کردن .eml یا .zip",
"keyboard_shortcuts": "میانبرهای صفحه کلید (?)",
"email_source": "منبع ایمیل",
+1
View File
@@ -298,6 +298,7 @@
"print": "Imprimer",
"view_source": "Voir la source",
"export_email": "Exporter en .eml",
"forward_as_attachment": "Forward as attachment",
"import_email": "Importer .eml ou .zip",
"keyboard_shortcuts": "Raccourcis clavier (?)",
"email_source": "Source de l'email",
+1
View File
@@ -245,6 +245,7 @@
"print": "הדפס",
"view_source": "צפה במקור",
"export_email": "ייצא כ-.eml",
"forward_as_attachment": "Forward as attachment",
"import_email": "ייבוא .eml",
"keyboard_shortcuts": "קיצורי מקשים (?)",
"email_source": "מקור דוא\"ל",
+1
View File
@@ -298,6 +298,7 @@
"print": "Nyomtatás",
"view_source": "Forrás megtekintése",
"export_email": "Exportálás .eml-ként",
"forward_as_attachment": "Forward as attachment",
"import_email": "Importálás .eml vagy .zip fájlból",
"keyboard_shortcuts": "Billentyűparancsok (?)",
"email_source": "E-mail forrás",
+1
View File
@@ -298,6 +298,7 @@
"print": "Stampa",
"view_source": "Visualizza sorgente",
"export_email": "Esporta come .eml",
"forward_as_attachment": "Forward as attachment",
"import_email": "Importa .eml o .zip",
"keyboard_shortcuts": "Scorciatoie da tastiera (?)",
"email_source": "Sorgente del messaggio",
+1
View File
@@ -298,6 +298,7 @@
"print": "印刷",
"view_source": "ソースを表示",
"export_email": ".emlとしてエクスポート",
"forward_as_attachment": "Forward as attachment",
"import_email": ".eml または .zip をインポート",
"keyboard_shortcuts": "キーボードショートカット (?)",
"email_source": "メールソース",
+1
View File
@@ -298,6 +298,7 @@
"print": "인쇄",
"view_source": "원본 보기",
"export_email": ".eml 파일로 내보내기",
"forward_as_attachment": "Forward as attachment",
"import_email": ".eml 또는 .zip 가져오기",
"keyboard_shortcuts": "단축키 (?)",
"email_source": "메일 원본",
+1
View File
@@ -298,6 +298,7 @@
"print": "Drukāt",
"view_source": "Skatīt avota kodu",
"export_email": "Eksportēt kā .eml",
"forward_as_attachment": "Forward as attachment",
"import_email": "Importēt .eml vai .zip",
"keyboard_shortcuts": "Īsinājumtaustiņi (?)",
"email_source": "Vēstules avota kods",
+1
View File
@@ -298,6 +298,7 @@
"print": "Afdrukken",
"view_source": "Bron bekijken",
"export_email": "Exporteren als .eml",
"forward_as_attachment": "Forward as attachment",
"import_email": ".eml of .zip importeren",
"keyboard_shortcuts": "Sneltoetsen (?)",
"email_source": "E-mailbron",
+1
View File
@@ -298,6 +298,7 @@
"print": "Drukuj",
"view_source": "Pokaż źródło",
"export_email": "Eksportuj jako .eml",
"forward_as_attachment": "Forward as attachment",
"import_email": "Importuj .eml lub .zip",
"keyboard_shortcuts": "Skróty klawiszowe (?)",
"email_source": "Źródło wiadomości",
+1
View File
@@ -298,6 +298,7 @@
"print": "Imprimir",
"view_source": "Ver código-fonte",
"export_email": "Exportar como .eml",
"forward_as_attachment": "Forward as attachment",
"import_email": "Importar .eml ou .zip",
"keyboard_shortcuts": "Atalhos de teclado (?)",
"email_source": "Código-fonte do E-mail",
+1
View File
@@ -298,6 +298,7 @@
"print": "Imprimare",
"view_source": "Vizualizați sursa",
"export_email": "Exportați ca fișier .eml",
"forward_as_attachment": "Forward as attachment",
"import_email": "Importați fișiere .eml sau .zip",
"keyboard_shortcuts": "Comenzi rapide de la tastatură (?)",
"email_source": "Sursa e-mailului",
+1
View File
@@ -298,6 +298,7 @@
"print": "Распечатать",
"view_source": "Просмотреть исходный код",
"export_email": "Экспортировать как .eml",
"forward_as_attachment": "Forward as attachment",
"import_email": "Импортировать .eml или .zip",
"keyboard_shortcuts": "Сочетания клавиш (?)",
"email_source": "Исходный код письма",
+1
View File
@@ -298,6 +298,7 @@
"print": "Tlačiť",
"view_source": "Zobraziť zdrojový kód",
"export_email": "Exportovať ako .eml",
"forward_as_attachment": "Forward as attachment",
"import_email": "Importovať .eml alebo .zip",
"keyboard_shortcuts": "Klávesové skratky (?)",
"email_source": "Zdrojový kód e-mailu",
+1
View File
@@ -298,6 +298,7 @@
"print": "Yazdır",
"view_source": "Kaynağı görüntüle",
"export_email": ".eml olarak dışa aktar",
"forward_as_attachment": "Forward as attachment",
"import_email": ".eml veya .zip içe aktar",
"keyboard_shortcuts": "Klavye kısayolları (?)",
"email_source": "E-posta Kaynağı",
+1
View File
@@ -298,6 +298,7 @@
"print": "Роздрукувати",
"view_source": "Переглянути джерело",
"export_email": "Експортувати як .eml",
"forward_as_attachment": "Forward as attachment",
"import_email": "Імпорт .eml або .zip",
"keyboard_shortcuts": "Комбінації клавіш (?)",
"email_source": "Джерело електронної пошти",
+1
View File
@@ -298,6 +298,7 @@
"print": "打印",
"view_source": "查看源码",
"export_email": "导出为 .eml",
"forward_as_attachment": "Forward as attachment",
"import_email": "导入 .eml 或 .zip",
"keyboard_shortcuts": "键盘快捷键(?)",
"email_source": "邮件源码",