docs(smtp): document Params.FromHeader usage pattern#187
Merged
Conversation
Agent-Logs-Url: https://github.com/amalgamated-tools/goauth/sessions/ce763e7c-ca32-4d82-b321-25728a62d7ad Co-authored-by: veverkap <22348+veverkap@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
veverkap
May 3, 2026 14:25
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Documents how to correctly use smtp.Params.From vs smtp.Params.FromHeader so callers can distinguish the SMTP envelope sender (MAIL FROM) from the RFC 5322 From: header value when composing raw messages.
Changes:
- Adds a
Paramsfields section explaining theFrom/FromHeadersplit and when they differ. - Adds a short example showing
params.FromHeaderused in theFrom:header before callingsmtp.Send.
Show a summary per file
| File | Description |
|---|---|
| docs/smtp.md | Documents Params.FromHeader usage and provides an example for composing From: correctly. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Clarify that display names are quoted per RFC 5322 and RFC 2047-encoded for non-ASCII characters, rather than the vague "MIME-encoded" wording - Add error handling for smtp.Send call in the FromHeader usage example
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.
smtp.Params.FromHeaderwas undocumented indocs/smtp.md, leaving callers without guidance on which field to use as theFrom:message header vs. the SMTP envelope sender.Changes
docs/smtp.md: Adds aParams fieldssection clarifying theFrom/FromHeadersplit —Fromis the bare address used internally bysmtp.Sendfor the SMTP envelope;FromHeaderis the RFC 5322-formatted string (properly quoted/MIME-encoded viamail.Address.String()when a display name is present) to set as theFrom:header in composed messages.Greptile Summary
This docs-only PR adds a
## Params fieldssection todocs/smtp.mdexplaining the distinction betweenParams.From(bare SMTP envelope address) andParams.FromHeader(RFC 5322-formatted string for theFrom:header). The description and code example accurately reflect the implementation insmtp.Validate(), including themail.Address.String()quoting/MIME-encoding behaviour and the fallback to the bare address when no display name is present.Confidence Score: 5/5
Safe to merge — documentation-only change with no code modifications.
The PR adds only documentation. The new section accurately reflects the implementation in smtp.go (the From/FromHeader split, mail.Address.String() behaviour, and bare-address fallback are all correct). The previous thread concern about unchecked smtp.Send error has been addressed. No logic, security, or correctness issues found.
No files require special attention.
Important Files Changed
Params fieldssection documenting theFrom/FromHeadersplit with a table and code example; content accurately reflects the implementation insmtp.go.Sequence Diagram
sequenceDiagram participant App participant cfg as smtp.Config participant params as smtp.Params participant server as SMTP Server App->>cfg: LoadConfig() App->>cfg: Validate() cfg->>params: From = parsed.Address cfg->>params: FromHeader = parsed.Address (no display name) OR mail.Address.String() (with display name) cfg-->>App: Params App->>App: Build message using params.FromHeader as From: header App->>server: smtp.Send(ctx, params, to, msg) uses params.From for MAIL FROM envelopeReviews (2): Last reviewed commit: "docs(smtp): fix RFC references and add e..." | Re-trigger Greptile