Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config: set up email sending using sendgrid #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

happy-devs
Copy link
Collaborator

@happy-devs happy-devs commented Dec 19, 2024

Summary

This PR introduces the email service using Sengrid and comprehensive logging functionality to better track and debug email sending operations.

New Features

  • comprehensive logging system with different log levels (INFO, DEBUG, ERROR)
  • validation of SendGrid environment variables during initialization
  • detailed step-by-step logging for email sending process
  • Added status code logging for both success and failure cases
  • Added logging configuration in main application

Bug Fixes

  • Fixed environment variable validation by adding explicit checks
  • Improved error handling with detailed error messages and stack traces
  • Enhanced debugging capability for unauthorized access issues

Checklist

  • I have read the contribution guidelines.
  • My code follows the style guidelines of this project.
  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added required dependencies to requirements.txt
  • I have updated the documentation (if applicable).

Additional Notes

The logging system now creates both console output and a log file (app.log) with the following features:

  • Timestamp for each log entry
  • Module name where the log was generated
  • Log level (INFO, DEBUG, ERROR)
  • Detailed message with context

This will help track down email delivery issues, particularly the 401 Unauthorized errors, by providing more context about:

  • Environment variable loading
  • API key validation
  • Email preparation steps
  • SendGrid API responses

To test these changes:

  1. Ensure SENDGRID_API_KEY and SENDGRID_FROM_EMAIL are properly set in .env
  2. Check app.log for detailed logging output
  3. Monitor console output for real-time logging information

@happy-devs happy-devs marked this pull request as ready for review December 19, 2024 17:01
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.

1 participant