Inline mail/internal/mail package into mail package#2423
Merged
paganotoni merged 1 commit intomodernize-go-featuresfrom Mar 20, 2026
Merged
Inline mail/internal/mail package into mail package#2423paganotoni merged 1 commit intomodernize-go-featuresfrom
paganotoni merged 1 commit intomodernize-go-featuresfrom
Conversation
This change eliminates the internal/mail package indirection by moving the SMTP implementation code directly into the main mail package. This simplifies the codebase and makes the mail package easier to understand and maintain. Changes made: - Moved all code from mail/internal/mail/* to mail/smtp_*.go files - Removed the mail/internal/ directory entirely - Renamed internal types to avoid conflicts (Message -> smtpMessage, etc.) - Unexported internal implementation details that don't need to be public - Added proper attribution to the go-mail/mail project (MIT License) - Added documentation comments to all exported types and functions - Added TODOs for future improvements from the original go-mail README: - Proper encoding of filenames for non-ASCII characters - Proper encoding of email addresses for non-ASCII characters - Testing embedded files and attachments for existence - Allowing io.Reader when embedding and attaching files The public API remains unchanged. Users can still configure to customize SMTP settings like SSL, TLSConfig, StartTLSPolicy, etc. The original go-mail/mail package provided a well-tested SMTP implementation that Buffalo has used internally. By inlining it with proper attribution, we maintain that functionality while reducing package complexity.
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.
Summary
This PR eliminates the package indirection by moving the SMTP implementation code directly into the main package. This simplifies the codebase and makes the mail package easier to understand and maintain.
Changes
Rationale
The original package was a vendored copy of the go-mail/mail library. While this provided a well-tested SMTP implementation, it added unnecessary package indirection. By inlining the code:
Public API
No breaking changes. Users can still configure to customize SMTP settings like SSL, TLSConfig, StartTLSPolicy, Timeout, etc.
TODOs for Future Work
Based on the original go-mail/mail README, these improvements are still pending: