Repository navigation
feat(providers): let a mail message choose its sender - #60
Merged
Merged
Conversation
MailMessage.from_address sets the From header, envelope sender and Message-ID domain of one message; the configured mail.from_address becomes the default. Named from_address rather than sender to match MailSettings and avoid confusion with the RFC 5322 Sender header. Closes #54 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 40 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This was referenced Nov 6, 2026
# Conflicts: # CHANGELOG.md # docs/providers-and-backends.md # jasil/backends/mail_memory.py # jasil/backends/mail_smtp.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds
MailMessage.from_address: str | None = None. When set, it is the message's sender (theFromheader, the envelope sender as its bare address, and theMessage-IDdomain) in place of the configuredmail.from_address, which becomes the default.SmtpMailandMemoryMailpass it tobuild_mime, which validates it with the sameparse_address(role="sender")as the configured sender. An invalid value is aValueErrorthat does not echo it, and the header-injection guarantees are unchanged.__hash__and equality.Additive: a new
MailMessagefield with a default.Related issue
Closes #54
Type of change
Checklist
Notes for the reviewer
from_address, notsenderas the issue proposed. It matchesMailSettings.from_address, and RFC 5322 has aSender:header with a different meaning.Nonefalls back, so a host bug that produces""fails loudly.From, which bulk senders sometimes want. It can be added when a host needs it.SmtpMail.sendandCHANGELOG.md. I'll rebase whichever merges second.Checks run: ruff, ruff format, lint-imports, mypy, pytest (3656 passed, 139 skipped, 97.79% coverage),
check_module_coverage.py,check_docs_api.py.🤖 Generated with Claude Code