Skip to content

[SES-PHASE-1-9] - PLU-744: send attachments with ses#1636

Draft
m0nggh wants to merge 1 commit into
feat/ses/add-bounce-rate-trackingfrom
feat/ses/include-attachments
Draft

[SES-PHASE-1-9] - PLU-744: send attachments with ses#1636
m0nggh wants to merge 1 commit into
feat/ses/add-bounce-rate-trackingfrom
feat/ses/include-attachments

Conversation

@m0nggh

@m0nggh m0nggh commented May 20, 2026

Copy link
Copy Markdown
Contributor

DRAFT, MAY DO THIS IN PHASE 2 INSTEAD

TL;DR

SES email routing now supports attachments via raw MIME, removes the previous attachment-blocks-SES restriction, and expands the set of file types accepted at upload time.

What changed?

  • sendEmailViaSes now builds a raw MIME message using nodemailer's MailComposer when attachments are present, allowing SES to carry attachments rather than falling back to Postman.
  • Replaced the old "no attachments allowed on SES" rule with a denylist (BLOCKED_ATTACHMENT_EXTENSIONS) that drops known executable/script types (.exe, .bat, .ps1, .vbs, etc.) before sending. The denylist is applied both upstream (in filterSesAttachments) and defensively inside sendEmailViaSes.
  • A 7 MB total attachment size guard is enforced before building the raw message to stay within SES's 10 MB raw email limit.
  • Provider routing is now computed before attachment filtering in the action layer, so the correct allowlist (Postman) or denylist (SES) is applied when validating attachments via filterAttachments.
  • ACCEPTED_FILE_TYPES on both frontend and backend is expanded to include SES-only types (SVG, WebP, HEIC, ZIP, RAR, JSON, XML, ICS, Markdown, EML, MSG, MP4, WebM). These types are accepted at upload time but may still be rejected at send time on the Postman path.
  • nodemailer and @types/nodemailer added as dependencies.

How to test?

  1. Enable the ses_enabled_domains flag for a test domain.
  2. Send a transactional email with a supported attachment (e.g. .pdf, .png) to a recipient in that domain — confirm it is delivered via SES with the attachment intact.
  3. Attempt to send with a blocked attachment type (e.g. .exe) — confirm it is filtered out and a warning is logged, but the email still sends with remaining valid attachments.
  4. Attempt to send with attachments totalling over 7 MB — confirm an error is thrown before the SES call is made.
  5. Send to a mixed batch (one SES-eligible recipient, one non-eligible) — confirm the entire batch falls back to Postman.
  6. Upload a file of a newly accepted SES-only type (e.g. .zip, .mp4) and confirm it is accepted at upload time and delivered when routing via SES.

Why make this change?

The original SES Phase 1 implementation blocked all attachments to keep the routing logic simple. This change lifts that restriction by using raw MIME encoding, enabling SES to handle the same attachment use cases as Postman while applying a security-focused denylist instead of Postman's narrower allowlist. This also allows a broader set of file types to be uploaded and delivered when the SES path is active.

@m0nggh m0nggh changed the title add draft for sending attachments with ses [SES-PHASE-1-9] - PLU-744: send attachments with ses May 20, 2026
@linear

linear Bot commented May 20, 2026

Copy link
Copy Markdown

PLU-744

@m0nggh m0nggh force-pushed the feat/ses/add-bounce-rate-tracking branch from b152844 to fcf855e Compare May 22, 2026 11:16
@m0nggh m0nggh force-pushed the feat/ses/include-attachments branch from 84dc544 to 53296e1 Compare May 22, 2026 11:16
@m0nggh m0nggh force-pushed the feat/ses/include-attachments branch from 53296e1 to 7b79c60 Compare June 8, 2026 09:03
@m0nggh m0nggh force-pushed the feat/ses/add-bounce-rate-tracking branch from fcf855e to 1741d4f Compare June 8, 2026 09:03
@m0nggh m0nggh force-pushed the feat/ses/include-attachments branch 2 times, most recently from a8e25ed to 13c52ce Compare June 8, 2026 12:02
@m0nggh m0nggh force-pushed the feat/ses/add-bounce-rate-tracking branch 2 times, most recently from 0d5d0c3 to 9ed7d91 Compare June 8, 2026 12:04
@m0nggh m0nggh force-pushed the feat/ses/include-attachments branch from 13c52ce to 0adf3aa Compare June 8, 2026 12:04
@m0nggh m0nggh force-pushed the feat/ses/add-bounce-rate-tracking branch from 9ed7d91 to 91509c9 Compare June 8, 2026 15:02
@m0nggh m0nggh force-pushed the feat/ses/include-attachments branch 2 times, most recently from 3717a82 to c23f3e0 Compare June 8, 2026 15:03
@m0nggh m0nggh force-pushed the feat/ses/add-bounce-rate-tracking branch 2 times, most recently from d903145 to de10911 Compare June 8, 2026 16:00
@m0nggh m0nggh force-pushed the feat/ses/include-attachments branch from c23f3e0 to bfbc0d9 Compare June 8, 2026 16:00
@m0nggh m0nggh force-pushed the feat/ses/add-bounce-rate-tracking branch from de10911 to 6cc0f29 Compare June 8, 2026 16:02
@m0nggh m0nggh force-pushed the feat/ses/include-attachments branch from bfbc0d9 to 0fa7e2e Compare June 8, 2026 16:02
@m0nggh m0nggh force-pushed the feat/ses/add-bounce-rate-tracking branch from 6cc0f29 to f9b2bb3 Compare June 8, 2026 16:48
@m0nggh m0nggh force-pushed the feat/ses/include-attachments branch from 0fa7e2e to 2690b61 Compare June 8, 2026 16:48
@m0nggh m0nggh force-pushed the feat/ses/include-attachments branch from 2690b61 to 95c9c94 Compare June 8, 2026 16:50
@m0nggh m0nggh force-pushed the feat/ses/add-bounce-rate-tracking branch from f9b2bb3 to 09f6135 Compare June 8, 2026 16:50
@m0nggh m0nggh force-pushed the feat/ses/add-bounce-rate-tracking branch from 09f6135 to eb4acd4 Compare June 8, 2026 16:57
@m0nggh m0nggh force-pushed the feat/ses/include-attachments branch from 95c9c94 to 8b197ac Compare June 8, 2026 16:57
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.

1 participant