Skip to content

[SSF-159] - Automated Emails 1 Implementation#127

Merged
dburkhart07 merged 15 commits intomainfrom
ddb/SSF-159-automated-emails
Mar 22, 2026
Merged

[SSF-159] - Automated Emails 1 Implementation#127
dburkhart07 merged 15 commits intomainfrom
ddb/SSF-159-automated-emails

Conversation

@dburkhart07
Copy link

@dburkhart07 dburkhart07 commented Mar 13, 2026

ℹ️ Issue

Closes #159

📝 Description

  • Created an email template to store an arbitrary amount of parameters to be used in the subject and body
  • Created temporary placeholders for ssf email, as well as base url (both to be later changed when we switch to production)
  • Implemented automated email sending workflows for creating a volunteer, submitting a pantry/fm application, getting a pantry/fm application approved, and submitting a food request
  • Wrote food manufacturer tests
  • Rewrote user tests

✔️ Verification

BEFORE TESTING: Add 2 new environment variables:

  • AWS_SES_SENDER_EMAIL (set this to one of your emails, this will be the address that sends the emails for you to verify)
  • SEND_AUTOMATED_EMAILS (switch this to true to turn on Cognito account creation and email sending permissions)

Add your email that you put in the AWS_SES_SENDER_EMAIL into the following AWS SES Identities: https://us-east-2.console.aws.amazon.com/ses/home?region=us-east-2#/identities

Tested each workflow to ensure the proper sender, subject, message, attachments were all there.

🏕️ (Optional) Future Work / Notes

Should figure out why this email gets sent to spam by default

@dburkhart07 dburkhart07 marked this pull request as ready for review March 13, 2026 22:29
@Juwang110 Juwang110 self-requested a review March 14, 2026 14:16
@Yurika-Kan Yurika-Kan self-requested a review March 18, 2026 00:44
Copy link
Collaborator

@Yurika-Kan Yurika-Kan left a comment

Choose a reason for hiding this comment

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

super great pr! super cool to test this & see emails come in as if i am the end user of this site :)

regarding the order of either saving to the db then sending emails and vice versa (specifically in request & user), i'd suggest to save the data first then send the appropriate email in cases that email sending fails. ideally we wouldn't wait for the email sending to succeed before saving that data. db is the source of truth & emails are more so secondary/side effect!

tested via:

  • verified email -> postman -> receiving emails
  • jest tests pass
    thanks for adding all these tests btw!

@dburkhart07 dburkhart07 requested a review from Yurika-Kan March 20, 2026 07:07
Copy link
Collaborator

@Yurika-Kan Yurika-Kan left a comment

Choose a reason for hiding this comment

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

currently, the ui & backend could mismatch since ui would think it failed the req but entity/row was successfully created:

errorful email -> db saves & ses errors = throws 500 internal server error -> frontend catches & shows generic failure

i think making it so that email failures are observable but don't corrupt frontend would make sense - so i suggest using a try & catch for sending emails (in foodRequests, pantries, manufacturers, users)

thanks for updating the tests

tested:

  • sending emails to admin, pantry, volunteer
  • errorful email = db saves but ses errors (internal server error)

pantryName: pantry.pantryName,
});

await this.emailsService.sendEmails(
Copy link
Collaborator

Choose a reason for hiding this comment

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

to make email non-blocking, can we wrap this in a try catch and send a logger warning indicating request created but email failed?

Copy link
Author

Choose a reason for hiding this comment

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

see slack comments for what i suggested might be a better approach.

@dburkhart07 dburkhart07 requested a review from Yurika-Kan March 21, 2026 18:28
Copy link
Collaborator

@Yurika-Kan Yurika-Kan left a comment

Choose a reason for hiding this comment

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

LGTMMMM

thank you for this super splendid work 💯

Copy link

@Juwang110 Juwang110 left a comment

Choose a reason for hiding this comment

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

Tested all emails send correctly for all flows, lgtm!!

@dburkhart07 dburkhart07 merged commit 0fe56a4 into main Mar 22, 2026
4 checks passed
@dburkhart07 dburkhart07 deleted the ddb/SSF-159-automated-emails branch March 22, 2026 20:02
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.

3 participants