Skip to content

📧 feat: Mailgun API Email Configuration #7742

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

Merged
merged 5 commits into from
Jun 4, 2025
Merged

Conversation

danny-avila
Copy link
Owner

Relevant documentation: LibreChat-AI/librechat.ai#317

Summary

  • Integrated Mailgun API support as an alternative to SMTP for email sending with proper configuration detection and fallback handling
  • Enhanced email configuration validation to support both Mailgun and SMTP providers
  • Improved error handling and logging throughout authentication flows

Other Changes

  • Fixed edge case in deleteUserController where deletion would fail when users had no conversations
  • Added undefined password validation in local authentication strategy to prevent crashes when users registered via social/OIDC login attempt password authentication
  • Fixed undefined SESSION_EXPIRY environment variable handling in user token generation to prevent crashes when the variable is not set or contains invalid expressions
  • Added comprehensive test suite for the generateToken method with 163 lines of test coverage including edge cases for invalid SESSION_EXPIRY values

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Testing

I tested the authentication flows with various SESSION_EXPIRY configurations and verified the email functionality works with both Mailgun and SMTP providers. The new test suite covers all edge cases for token generation including invalid expressions and missing environment variables.

Test Configuration:

  • Jest test environment with MongoDB mocking
  • Various SESSION_EXPIRY values including empty strings, invalid expressions, and valid time expressions
  • Authentication testing with users who have no password set
  • Email provider testing with both Mailgun and SMTP configurations

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • I have made pertinent documentation changes
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective or that my feature works
  • Local unit tests pass with my changes
  • Any changes dependent on mine have been merged and published in downstream modules.

@danny-avila danny-avila changed the base branch from main to dev June 4, 2025 17:12
@danny-avila danny-avila merged commit be4cf58 into dev Jun 4, 2025
7 checks passed
@danny-avila danny-avila deleted the feat/mailgun-emails branch June 4, 2025 17:12
MichielMAnalytics pushed a commit to MichielMAnalytics/ProAI that referenced this pull request Jun 26, 2025
* fix: add undefined password check in local user authentication

* fix: edge case - issue deleting user when no conversations in deleteUserController

* feat: Integrate Mailgun API for email sending functionality

* fix: undefined SESSION_EXPIRY handling and add tests

* fix: update import path for isEnabled utility in azureUtils.js to resolve circular dep.
kenshinsamue pushed a commit to intelequia/LibreChat that referenced this pull request Aug 4, 2025
* fix: add undefined password check in local user authentication

* fix: edge case - issue deleting user when no conversations in deleteUserController

* feat: Integrate Mailgun API for email sending functionality

* fix: undefined SESSION_EXPIRY handling and add tests

* fix: update import path for isEnabled utility in azureUtils.js to resolve circular dep.
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