Skip to content

Email SeS implementation#19

Merged
Mayank808 merged 10 commits intomainfrom
mayank/amazon-ses-impl
Feb 26, 2025
Merged

Email SeS implementation#19
Mayank808 merged 10 commits intomainfrom
mayank/amazon-ses-impl

Conversation

@Mayank808
Copy link
Copy Markdown
Collaborator

@Mayank808 Mayank808 commented Dec 30, 2024

Notion ticket link

Setup Email System

NOTE THIS IS A PR for feedback not to merge.
Will be removing email.py route as its simply there right now for testing
will be removing todos and adding comments
will be removing any prints or updating them to logs

Implementation description

  • Implemented Email sending using amazon ses.
  • Create email templates at startup
  • use email templates to send single and bulk emails to users with predefined templates
  • Email templates can use inline CSS need to define a text file with only text for each respective email

Process to create a new Email Template to use:

  1. Create the HTML and Text files for the new template. Use inline CSS and direct hosted links to any images required.
  2. Update backend/app/utilities/ses/ses_templates.json to include template name subject and absolute paths to the above file
  3. Create a new data class Type for the Email template
@dataclass
class NewEmailTemplatData():
    name: str
    date: str
    random: int
  1. Update Email template enum to include the file name of the template defined in amazon ses and the ses_templates.json file
class EmailTemplate(Enum):
   NEWEMAILTEMPLATE = "newemailtemplate"
  1. Use in code to send emails using email service
email_service.send_email(
    template=EmailTemplate.NEWEMAILTEMPLATE,
    content=EmailContent[NewEmailTemplatData](
        recipient=recipient, 
        data=NewEmailTemplatData(name=user_name, date="2021-12-01", random: 20)
    ),
)

Todo

  • Add bulk send email after general flow is good
  • Look into schedule send
  • Clean up logging and comments
  • Remove email.py route
  • Unit Testing
  • File clean up

Steps to test

  1. Simply hit the /email/send-test email route when running the be on local

What should reviewers focus on?

  • Focus on overall design of things and how things are laid out as this pr still needs to be cleaned up.
  • How templates are defined, what folders code blocks should be stored in
  • Are we okay with running the email template check on startup
  • Will be removing email.py route as its simply there right now for testing

Checklist

  • My PR name is descriptive and in imperative tense
  • My commit messages are descriptive and in imperative tense. My commits are atomic and trivial commits are squashed or fixup'd into non-trivial commits
  • I have run the appropriate linter(s)
  • I have requested a review from the PL, as well as other devs who have background knowledge on this PR or who will be building on top of this PR

@Mayank808 Mayank808 requested a review from mslwang December 30, 2024 06:25
Copy link
Copy Markdown
Collaborator

@mslwang mslwang left a comment

Choose a reason for hiding this comment

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

Great work here! Left some general comments

Comment thread backend/app/interfaces/email_service.py Outdated
Comment thread backend/app/interfaces/email_service.py Outdated
Comment thread backend/app/interfaces/email_service.py Outdated
Comment thread backend/app/interfaces/email_service.py Outdated
Comment thread backend/app/interfaces/email_service_provider.py Outdated
Comment thread backend/app/services/email/email_service_provider.py
Comment thread backend/app/services/email/email_service_provider.py Outdated
Comment thread backend/app/services/email/email_service_provider.py
Comment thread backend/app/utilities/ses/ses_init.py Outdated
Comment thread backend/app/utilities/ses/ses_init.py
@Mayank808 Mayank808 requested a review from ebwu95 February 12, 2025 01:03
@Mayank808 Mayank808 marked this pull request as ready for review February 12, 2025 01:10
@Mayank808 Mayank808 requested a review from mmiqball February 12, 2025 01:33
Copy link
Copy Markdown
Contributor

@ebwu95 ebwu95 left a comment

Choose a reason for hiding this comment

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

LGTM! Great work

Comment thread backend/app/server.py Outdated
Comment thread backend/app/routes/email_test.py Outdated
Copy link
Copy Markdown
Collaborator

@mmiqball mmiqball left a comment

Choose a reason for hiding this comment

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

looks good to me

@Mayank808 Mayank808 requested a review from ebwu95 February 26, 2025 01:24
@Mayank808 Mayank808 merged commit 9808930 into main Feb 26, 2025
@Mayank808 Mayank808 deleted the mayank/amazon-ses-impl branch February 26, 2025 19:53
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.

4 participants