Skip to content

#127 - harden SES email feature: auth, plain-text, logging#132

Open
piersolh wants to merge 2 commits into
mainfrom
piersol-SES-refinement
Open

#127 - harden SES email feature: auth, plain-text, logging#132
piersolh wants to merge 2 commits into
mainfrom
piersol-SES-refinement

Conversation

@piersolh

@piersolh piersolh commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Description

NOTE: emails still go to spam because I am using my personal email as the SES email. we need to use a verified email to stop getting hit with gmail's spam filter.

Re-enables auth on the email endpoints, adds plain-text alternatives and per-recipient bulk failure logging for deliverability, guards template variable replacement, and stops referencing images locally.

Changes Made

  • Backend changes
  • Frontend changes
  • Database schema changes
  • Configuration updates
  • Other

Details:

  • Re-enable @UseGuards(AuthGuard('jwt')) on all bulk-send and template-management endpoints (send-email, template GET/POST, subscribers, bulk-send)
  • Attach a text/plain alternative to every email (multipart/alternative) via a lightweight htmlToPlainText util
  • Bulk sends now go one email per recipient: one bad address no longer aborts the campaign, each failure is logged individually, recipients aren't exposed via a shared To, and the response surfaces a failed count.
  • Wrap donation-response template variable replacement in try/catch for more safety
  • Signature only renders https://-hosted images (local PNG import removed) so images resolve in recipients' inboxes.

Testing & Verification

  • Unit tests pass
  • Manual testing completed
  • [] No breaking changes

Verification Steps:

  • sent email(s) to self
Screenshot 2026-06-15 at 3 30 07 PM Screenshot 2026-06-15 at 3 32 03 PM

Future Improvements/Notes

  • Unsubscribe link still outstanding. A proper unsubscribe needs (1) a footer link in buildFullHTML, (2) a public GET /emails/unsubscribe endpoint flipping isSubscribed/unsubscribedAt (columns already exist), and optionally (3) a List-Unsubscribe header for bulk deliverability. Being handled separately.
  • CDN/S3 hosting of signature images will be wired up as part of the email-signature work.

Related Issues

Closes #127

- Re-enable AuthGuard('jwt') on all bulk-send and template management endpoints
- Attach plain-text alternative to every email (multipart/alternative) for deliverability
- Add per-recipient send + failure logging for bulk campaigns; surface failed count
- Wrap donation-response template variable replacement in try/catch with raw-template fallback
- Only render https-hosted signature images (drop local PNG import) so images aren't referenced locally

return (
html
// Drop content of non-visible elements entirely.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is really excessive commenting but I thought it might be helpful cause regex's are so hard to read

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good!

@thaninbew thaninbew self-requested a review June 15, 2026 12:13
@piersolh piersolh changed the title #95 - harden SES email feature: auth, plain-text, logging #127 - harden SES email feature: auth, plain-text, logging Jun 15, 2026
@piersolh piersolh marked this pull request as ready for review June 15, 2026 19:33
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.

SES #3

2 participants