fix(email): make team org invites more transactional (#732)

* fix(email): make team org invites more transactional

Use org-branded sender and subject instead of the default
"Best from ClassroomIO" marketing identity. Include the inviter
name in the body, remove promotional emojis, and thread optional
subject overrides through the email job pipeline.

Co-authored-by: Rotimi Best <[email protected]>

* fix(email): escape invite fields and sanitize email headers

Address Greptile review: escape inviter/org/role values in the team
invite template, sanitize display names in buildEmailFromName, and
strip control characters from dynamic subjects.

Co-authored-by: Rotimi Best <[email protected]>

* fix(email): use RFC 5322 backslash escaping in display names

Co-authored-by: Rotimi Best <[email protected]>

* test(email): add vitest coverage for email header helpers

Cover escapeHtml, sanitizeEmailDisplayName, sanitizeEmailSubject, and
buildEmailFromName. Collapse repeated whitespace when stripping control
characters from header values.

Co-authored-by: Rotimi Best <[email protected]>

* fix(email): strip all ASCII control chars from email headers

Co-authored-by: Rotimi Best <[email protected]>

---------

Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: Rotimi Best <[email protected]>
This commit is contained in:
Rotimi Best
2026-07-11 22:22:36 +01:00
committed by GitHub
co-authored by Rotimi Best Cursor Agent
parent 1a9c240501
commit c03c08fc84
12 changed files with 159 additions and 15 deletions
+2
View File
@@ -12,6 +12,8 @@ export const ZSendTemplateEmailPayload = z.object({
fields: z.record(z.string(), z.unknown()).default({}),
from: z.string().optional(),
replyTo: z.string().optional(),
/** Override the template's default subject (e.g. org-scoped transactional mail). */
subject: z.string().min(1).optional(),
/** Optional iCalendar (.ics) body attached as a text/calendar part. */
ics: z.string().optional()
});