hngprojects / hng_boilerplate_python_fastapi_web

Apache License 2.0
154 stars 137 forks source link

feat: Added send email template endpoint #979

Closed theijhay closed 3 weeks ago

theijhay commented 3 weeks ago

Description

Implemented the functionality to send email templates. This includes robust error handling, retry mechanisms, and detailed logging to ensure that failures in sending emails do not disrupt the user experience. Additionally, ensured that user data is securely saved even if the email sending process fails. Unit tests were added to cover both successful and failure scenarios related to sending email templates.

Related Issue (Link to issue ticket)

Related issue

Motivation and Context

This change is required to provide a reliable mechanism for sending email templates as part of the user interaction workflow. It solves the problem of potential data loss or user experience issues caused by failures in the email sending process. By adding retries and logging, the system becomes more resilient and easier to troubleshoot in case of errors.

How Has This Been Tested?

The implementation was tested using a suite of unit tests that simulate both successful email sending and various failure scenarios (e.g., network issues, invalid email addresses). The tests ensured that errors are handled gracefully, retries are attempted as expected, and logs are generated for troubleshooting. All tests were run in a local development environment using mock services to simulate email sending.

Screenshots (if appropriate - Postman, etc):

Screenshot from 2024-08-25 07-43-57

Types of changes

Checklist: