Skip to content

feat(enterprise): add RESEND_FROM_EMAIL for self-hosted Resend sends#28830

Merged
mateo-berri merged 1 commit into
litellm_internal_stagingfrom
litellm_resend_from_email
May 30, 2026
Merged

feat(enterprise): add RESEND_FROM_EMAIL for self-hosted Resend sends#28830
mateo-berri merged 1 commit into
litellm_internal_stagingfrom
litellm_resend_from_email

Conversation

@shivamrawat1

Copy link
Copy Markdown
Collaborator

Description
Adds optional RESEND_FROM_EMAIL support to ResendEmailLogger, matching the existing SendGrid pattern (SENDGRID_SENDER_EMAIL). Self-hosted installs can send from a domain verified in their own Resend account instead of the hardcoded LiteLLM default.

Cause
ResendEmailLogger always sent from [email protected] (via BaseEmailLogger.DEFAULT_LITELLM_EMAIL). That address works on LiteLLM Cloud but fails on self-hosted setups — Resend returns 403 Forbidden when the sender domain isn't verified on the caller's account.

SendGrid already supports a custom sender via SENDGRID_SENDER_EMAIL; Resend had no equivalent.

Fix
Read RESEND_FROM_EMAIL in ResendEmailLogger.init
Resolve sender as RESEND_FROM_EMAIL or from_email before calling the Resend API
Preserve existing behavior when the env var is unset (falls back to [email protected])
Add unit tests for override and fallback paths
Usage:

RESEND_API_KEY=re_xxxx
RESEND_FROM_EMAIL=[email protected] # verified domain in Resend
Test plan

uv run pytest tests/test_litellm/enterprise/enterprise_callbacks/send_emails/test_resend_email.py -v

Restart proxy with RESEND_FROM_EMAIL set; create a key with "Send email" enabled and confirm delivery in Resend dashboard

Screenshot 2026-05-25 at 8 00 16 PM

Allow self-hosted installs to override the default LiteLLM sender address
via RESEND_FROM_EMAIL, matching SendGrid's SENDGRID_SENDER_EMAIL pattern.

Co-authored-by: Cursor <[email protected]>
@greptile-apps

greptile-apps Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds optional RESEND_FROM_EMAIL support to ResendEmailLogger, mirroring the existing SENDGRID_SENDER_EMAIL pattern so self-hosted users can send from a domain verified in their own Resend account instead of the hardcoded LiteLLM Cloud address.

  • resend_email.py: Reads RESEND_FROM_EMAIL once at init; in send_email, resolves the actual sender as self.resend_from_email or from_email, preserving the old behavior when the env var is absent.
  • test_resend_email.py: Adds two new mock-only tests covering the override and fallback scenarios; updates mock_env_vars fixture to explicitly pop RESEND_FROM_EMAIL so pre-existing values in the test environment don't leak into tests that expect the default behavior.

Confidence Score: 5/5

Safe to merge — a two-line production change with full mock test coverage and no behavior change when the env var is absent.

The implementation is minimal and follows the existing SENDGRID_SENDER_EMAIL pattern exactly. The env var is read once at init (consistent with RESEND_API_KEY), the fallback preserves today's behavior, all new tests use mocks (no real network calls), and the fixture correctly isolates the env var across runs.

No files require special attention.

Important Files Changed

Filename Overview
enterprise/litellm_enterprise/enterprise_callbacks/send_emails/resend_email.py Adds RESEND_FROM_EMAIL env var support: reads it at init time and uses it as the sender address when set, falling back to the caller-supplied from_email.
tests/test_litellm/enterprise/enterprise_callbacks/send_emails/test_resend_email.py Adds two new mock-only tests for the override and fallback paths; updates the mock_env_vars fixture to explicitly pop RESEND_FROM_EMAIL for isolation; whitespace cleanup elsewhere.

Reviews (1): Last reviewed commit: "feat(enterprise): add RESEND_FROM_EMAIL ..." | Re-trigger Greptile

@codecov

codecov Bot commented May 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mateo-berri mateo-berri left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM; thanks!

@mateo-berri mateo-berri merged commit 967fed1 into litellm_internal_staging May 30, 2026
113 of 116 checks passed
@mateo-berri mateo-berri deleted the litellm_resend_from_email branch May 30, 2026 17:13
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
…erriAI#28830)

Allow self-hosted installs to override the default LiteLLM sender address
via RESEND_FROM_EMAIL, matching SendGrid's SENDGRID_SENDER_EMAIL pattern.

Co-authored-by: Cursor <[email protected]>
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.

2 participants