From f6e6a3186ca022e82147cacc86b9244dc081e484 Mon Sep 17 00:00:00 2001 From: jelveh Date: Mon, 20 Jul 2026 10:38:27 -0700 Subject: [PATCH] feat(email): accept custom message headers in sendRaw Lets callers set transport-level headers such as List-Unsubscribe / List-Unsubscribe-Post. Also documents the puter-email driver's automatic unsubscribe / report-abuse footer and the new `suppressed` result field in the puter.js email module. --- src/backend/clients/email/EmailClient.ts | 2 ++ src/puter-js/src/modules/Email.js | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/backend/clients/email/EmailClient.ts b/src/backend/clients/email/EmailClient.ts index 60faf2116..f345f630d 100644 --- a/src/backend/clients/email/EmailClient.ts +++ b/src/backend/clients/email/EmailClient.ts @@ -50,6 +50,8 @@ export interface SendMailOptions { text?: string; replyTo?: string; attachments?: EmailAttachment[]; + /** Extra message headers (e.g. List-Unsubscribe), passed to the transport. */ + headers?: Record; } export type EmailValidator = (email: string) => Promise | boolean; diff --git a/src/puter-js/src/modules/Email.js b/src/puter-js/src/modules/Email.js index 833abcf86..d87385ae8 100644 --- a/src/puter-js/src/modules/Email.js +++ b/src/puter-js/src/modules/Email.js @@ -22,6 +22,11 @@ import * as utils from '../lib/utils.js'; * }); * * Positional form: `await puter.email.send(to, subject, body)`. + * + * Every mail automatically gets an unsubscribe / report-abuse footer. + * Recipients who unsubscribe are dropped from future sends — they come + * back in the result's `suppressed` array — and a send whose `to` list + * is entirely unsubscribed is rejected. */ class Email { /**