Skip to content

Features: email notification system #6

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

Draft
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

happy-devs
Copy link
Collaborator

Summary

This PR addresses the email notification system configuration and permissions issues, specifically focusing on the setup for the "[email protected]" sender email address. The changes aim to resolve the current access denied errors and establish proper email sending capabilities through Microsoft Graph API.

New Features

  • Added comprehensive email service testing script
  • Implemented Azure CLI authentication verification
  • Enhanced error logging for email service debugging
  • Added support for Mail.Send permission validation

Bug Fixes

  • Identified and documented the access denied issue with MS Graph API permissions
  • Found mismatch between authenticated user and sender email permissions
  • Discovered missing Mail.Send delegated/application permissions

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
  • I have added required dependencies to requirements.txt
  • I have updated the documentation

Technical Investigation Results

Current Setup

Identified Issues

  1. Permission Configuration:

    • Current application (ID: 4b179bfc-6621-409a-a1ed-ad141c12eb11) lacks proper Mail.Send permissions
    • Authenticated user cannot send as [email protected]
    • Missing either application-level or delegated permissions with "Send As" rights
  2. Authentication Flow:

    • Successfully authenticating with Azure CLI
    • Token includes correct Graph API scope
    • Receiving 403 Forbidden when attempting to send

Required Actions

  1. Azure Portal Configuration:

    • Navigate to App Registration (ID: 4b179bfc-6621-409a-a1ed-ad141c12eb11)
    • Add required permissions:
      • Option A: Mail.Send (delegated)
      • Option B: Mail.Send (application)
    • Obtain admin consent for new permissions
  2. Exchange/Graph Permissions:

    • Request "Send As" rights for [email protected]
    • Or update MS_FROM_EMAIL to use authenticated user's email

Additional Notes

Implementation Options:

  1. Application-level Permissions:

    • Pros: Can send as any user, simpler setup
    • Cons: Requires higher privilege level, admin consent
  2. Delegated Permissions with "Send As":

    • Pros: More secure, follows least privilege
    • Cons: Requires additional Exchange admin setup
  3. Temporary Solution:

    • Use authenticated user's email for testing
    • Update MS_FROM_EMAIL in .env
    • Allows immediate testing while permanent solution is implemented

Next Steps:

  1. Choose implementation approach (application vs delegated)
  2. Update Azure AD permissions
  3. Obtain necessary admin consents
  4. Update email service configuration
  5. Verify with test script

@happy-devs happy-devs changed the title Features/email sending Features: email notification system Apr 21, 2025
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