atlas-cli / nestjs-boilerplate

NestJs Modular Monolith with AWS Lambda and CDK
19 stars 5 forks source link

Update MailService to use Handlebars templates and AWS SES #18

Closed charlesmuller194 closed 7 months ago

charlesmuller194 commented 1 year ago

This pull request updates the MailService class by introducing Handlebars templates for email content and integrating the AWS SES (Simple Email Service) for sending emails. The sendPasswordResetEmail and sendActivationEmail methods now use the templates for generating email content and utilize the AWS SES service to send the emails.

The new implementation makes it easier to customize and maintain the email templates, and provides a more reliable and scalable email delivery solution. The code has been tested locally and meets the requirements specified in the original implementation.

List of changes:

  1. Added Handlebars and AWS dependencies.
  2. Imported I18nModule and I18nService from nestjs-i18n.
  3. Created resetTemplate and signupTemplate as HandlebarsTemplateDelegate for email content.
  4. Updated constructor to initialize ses as AWS.SES object and resetTemplate and signupTemplate as their respective compiled Handlebars templates.
  5. Updated sendPasswordResetEmail and sendActivationEmail methods to use the Handlebars templates for generating email content.
  6. Added subject and content variables to the email sending methods.
  7. Updated params object to use content variable for email content and subject variable for the email subject.
  8. Updated params object to use a configured sender email address.
  9. Updated try-catch block to log success or error messages when sending the email.
  10. Updated handlebars templates for mail activation and reset password
sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information