-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Overview
We want our donation form to send an automated "Thank You" email after a donation is successfully processed
- For more clarity, you can refer to this article (https://dev.to/aws-builders/aws-ses-with-a-nestjs-backend-to-send-email-verifications-2l9h)
- I would also recommend checking out the Amazon SES documentation (https://docs.aws.amazon.com/ses/)
Tasks
- Create a service for email sending
- In
apps/backend/src, create a new folderemails, make a new fileemails.service.tsand create a class within it calledEmailsService - In this file, add a function
sendEmailthat takes in the destination email, subject, and email content and uses an SES client to send the email - If the send fails for any reason, log a relevant error message to the logger (
this.logger.error())
- In
- Create a controller
- In the same folder, make a new file
emails.controller.tsand create a class within it calledEmailsController - In this file, add a POST request at the
emails/send-emailendpoint that calls thesendEmailfunction in the service
- In the same folder, make a new file
- Create a module
- In the same folder, make a new file
emails.module.ts - Its
controllersarray should include the controller created earlier, and itsprovidersarray should include the service created earlier
- In the same folder, make a new file
- Create unit tests
emails.service.spec.ts- Test successful email sending, and an error message being logged in case of a failure
Acceptance Criteria
- SES endpoint follows NestJS dependency injection pattern
EmailsServicesuccessfully sends emails when the endpoint is called- Code is documented well
- Unit tests pass with mocked SES client
piersolh
Metadata
Metadata
Assignees
Labels
No labels