Skip to content

feat(mail): send headers, a plain text part and an ses configuration set - #2

Merged
arjendevos merged 6 commits into
mainfrom
feat/mail-headers-text-configuration-set
Nov 24, 2026
Merged

arjendevos merged 6 commits into
mainfrom
feat/mail-headers-text-configuration-set

Conversation

@arjendevos

Copy link
Copy Markdown
Contributor

Bulk mail needs a List-Unsubscribe header and a plain text part, and marketing mail needs its own SES configuration set, so its bounces and complaints are reported apart from transactional mail.

  • Envelope.Headers and Envelope.ConfigurationSet, merged over the default envelope: headers append, the configuration set overrides.
  • Content.TextView, optional, rendered with the same With. Without it a mail is HTML alone, as before.
  • SES sends the headers (Message.Headers), the text body and ConfigurationSetName. Message building moved into buildMessage so it can be tested.
  • SMTP sets the headers, sends the configuration set as X-SES-CONFIGURATION-SET (which SES's SMTP interface reads), and sends text with the HTML as its alternative.
  • The fake adapter records the text, headers and configuration set.

Bulk mail needs a List-Unsubscribe header and a text part, and marketing mail needs its own SES configuration set so its bounces and complaints are reported apart from transactional mail. Envelope gains Headers and ConfigurationSet, merged over the default envelope; Content gains an optional TextView. SES sends all three; SMTP sends the headers, the configuration set as X-SES-CONFIGURATION-SET, and the text with the HTML as its alternative.
Tests live in tests/, mirroring the code. The test now sends through Adapter.Send against a local server standing in for SES (AWS_ENDPOINT_URL_SESV2), so it reads what is actually sent.
Split the SMTP adapter's headers and body out of Send, preallocate the SES headers but send none when there are none, and wrap a long line in the SES test.
A mail's header now takes the place of a default one of the same name, whatever its case, instead of going out twice. CheckHeaders refuses reserved names (From, To, Bcc and the like, which over SMTP would change who gets the mail), names SES would not take, and values with a line break; both adapters check before sending. TextView moves after With so unkeyed Content literals keep compiling, and SendCall keeps its fields' order. The SMTP adapter gets tests against a local server, and the merge test now has a default with room to spare, so it fails if a merge leaks into the next mail.
@arjendevos
arjendevos merged commit a70160c into main Nov 24, 2026
1 of 6 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.

1 participant