Commit graph

1013 commits

Author SHA1 Message Date
476130d6e3
Fumpt files to make golangci-lint happy 2024-10-05 11:43:50 +02:00
a0a7f74121
Refactor file.go comments for clarity and detail
Improved comments for better readability and understanding. Enhanced descriptions for File, FileOption, and various methods, providing more context and precision. Added notes on default behaviors and specific use cases for methods where applicable.
2024-10-05 11:42:21 +02:00
ecd0bff5ad
Update comments for better clarity and add RFC references
Revised the comments to provide more detailed descriptions and context for each type and constant. Additionally, included relevant RFC document references where applicable to improve understanding of encoding and MIME types.
2024-10-05 11:23:44 +02:00
5653df373b
Add periods to end of go doc comments
Ensure all go doc comments in eml.go have consistent punctuation by adding periods to the end of each comment. This improves code readability and maintains uniformity in the documentation style.
2024-10-05 11:11:17 +02:00
869e8db6c5
Improve package documentation and description
Expand the package mail description to highlight ease of use, reliance on the Go Standard Library, and added functionalities. Clarify the role of VERSION in the user agent string.
2024-10-05 11:06:46 +02:00
fa3c6f956e
Update Send function documentation for better clarity
Enhanced the documentation of the `Send` function to explicitly describe the behavior when the Client has no active connection and the handling of multiple message transmissions. This ensures developers understand the error handling mechanism and the association of `SendError` with each message.
2024-10-05 11:02:26 +02:00
159c1bf850
Add tests for new tls and connection handling methods
This commit introduces tests for various TLS-related methods such as GetTLSConnectionState, HasConnection, SetDSNMailReturnOption, SetDSNRcptNotifyOption, and UpdateDeadline. It also modifies the error handling logic in smtp.go to include new error types and improves the mutex handling in UpdateDeadline.
2024-10-05 10:55:25 +02:00
9163943684
Add isConnected flag to track active connection state
Introduced the isConnected boolean flag in the Client struct to clearly indicate whether there is an active connection. Updated relevant methods to set this flag accordingly, ensuring consistent state management across the Client's lifecycle.
2024-10-05 10:15:43 +02:00
fbbf17acd0
Refactor comments for clarity in client.go
Simplify comments in `client.go` to improve code documentation. Ensure comments are more descriptive and provide context for the functions they describe, enhancing code readability and maintainability.
2024-10-04 23:25:43 +02:00
48b469faf7
Refactor SMTP client comment and function documentation
Updated function comments across client.go to improve clarity and consistency. Added missing details on error handling and context usage for `DialAndSendWithContext` and ensured all functions contain relevant, detailed descriptions.
2024-10-04 23:23:16 +02:00
adcb8ac41d
Fix connection handling and improve thread-safety in SMTP client
Reset connections to nil after Close, add RLock in HasConnection, and refine Close logic to handle already closed connections gracefully. Enhanced DialWithContext documentation and added tests for double-close scenarios to ensure robustness.
2024-10-04 23:15:01 +02:00
dfdadc5da2
Refactor client.go: Move functions to new locations
Reordered several functions within client.go for better code organization and readability. This change involves moving `setDefaultHelo`, `checkConn`, `serverFallbackAddr`, and `tls` functions to new locations without altering their implementations.
2024-10-04 22:38:18 +02:00
8942b08424
Add validation for custom SMTP auth type in client tests
Previously, only the presence of the SMTP auth method was checked, but not its type. This additional validation ensures that the SMTP auth type is correctly set to custom, thereby improving test accuracy.
2024-10-04 22:36:28 +02:00
972a3c51c7
Add custom SMTP authentication type support
Introduce the SMTPAuthCustom type to represent user-defined SMTP authentication mechanisms. Updated relevant functions in client.go to handle the new type appropriately and made sure the client distinguishes between built-in and custom authentication methods.
2024-10-04 22:33:42 +02:00
d900f5403e
Refine method documentation in client.go
Correct typos and enhance clarity in method descriptions. Provide additional context for default values and behavior, and specify consequences for security settings in client configurations.
2024-10-04 22:23:18 +02:00
eeaee3f60a
Update and expand documentation for client configuration options
Revised comments provide clearer guidance on the usage of various client configuration functions. Additional details and external references are included for better understanding and error handling.
2024-10-04 21:57:38 +02:00
bae0ac6cde
Refactor TLS policy comments for clarity
Updated comments for WithTLSPolicy and WithTLSPortPolicy to provide clearer explanations. Improved readability and emphasized recommended best practices for SMTP TLS connections.
2024-10-04 21:45:12 +02:00
3e5c93a418
Refine and clarify SSL and debug logging comments
Revised the comments for `WithSSLPort`, `WithDebugLog`, `WithLogger`, and `WithHELO` options to improve readability and provide clearer explanations. Added caution about potential data protection issues when using debug logging and specified defaults where applicable.
2024-10-04 21:38:39 +02:00
a34f400a05
Improve client option documentation for clarity and validation
Enhanced the documentation for NewClient and related option functions to provide clearer descriptions. Added validation details for WithPort and WithTimeout, and improved explanations for SSL/TLS settings.
2024-10-04 21:26:29 +02:00
779a3f3942
Refactor error comments for clarity
Updated error comments to provide clearer and more descriptive explanations. Enhanced readability by elaborating on the conditions that result in each error, giving developers better context. No functional changes to the code were made.
2024-10-04 21:12:05 +02:00
6cd3cfd2f7
Refactor comments for clarity and consistency
Rephrase comments to enhance clarity and maintain consistent style. Improved explanations for fields such as `smtpAuth`, `helo`, and `noNoop`, and standardize grammar and format across all comments. This helps in better understanding the code and its functionality.
2024-10-04 20:57:51 +02:00
aab04672f8
Rename DSN type variable for clarity
Renamed the variable from `dsnrntype` to `dsnRcptNotifyType` to improve code readability and ensure clarity regarding its purpose. Also updated corresponding comments and test cases to reflect this change.
2024-10-04 20:39:14 +02:00
f7c12d412b
Rename dsnmrtype to dsnReturnType in client.go
Refactor variable names for consistency. The `dsnmrtype` variable has been renamed to `dsnReturnType` across the client and test files to improve code readability and maintain uniformity.
2024-10-04 20:30:43 +02:00
ef3da39840
Refactor DSN field in Client structure
Renamed `dsn` field to `requestDSN` in Client structure for clarity and consistency. Adjusted associated methods and tests to reflect this change, improving code readability and maintainability.
2024-10-04 20:29:14 +02:00
92c411454b
Enhance comments with detailed explanations and links
Improved comments for better clarity by detailing the purpose of each constant and type, and included relevant RFC links for deeper context. These changes aim to help developers quickly understand the code without needing to cross-reference external documents.
2024-10-04 20:13:13 +02:00
59e91eb936
Update RFC URLs to use html versions
Changed the URLs for RFC 4954 and RFC 4616 from plain text to HTML formats for improved readability and consistency. This adjustment does not affect the functionality but enhances the documentation quality.
2024-10-04 20:00:49 +02:00
6a9c8bb56b
Refactor documentation and comments for clarity
Streamlined comments and documentation in `b64linebreaker.go` for better readability and consistency. Improved descriptions of the Base64LineBreaker and its methods to ensure clarity on functionality.
2024-10-04 19:50:10 +02:00
ea90352ef4
Refactor SMTPAuthType comment for clarity
Updated the comment for SMTPAuthType to more clearly explain its purpose as a type wrapper for SMTP authentication mechanisms. This improves code readability and helps future developers understand the type's function.
2024-10-04 19:45:37 +02:00
e8739b88b0
Enhance SMTP AUTH comments and error descriptions
Extended documentation for each SMTP AUTH type including security considerations, relevant specifications, and the context for usage. Updated error descriptions for consistency and clarity. This enhances readability and provides better guidance for developers.
2024-10-04 19:44:41 +02:00
b9888929f8
Merge pull request #323 from wneessen/more-scram-auth-test
Add support for SCRAM-SHA-1-PLUS and SCRAM-SHA-256-PLUS
2024-10-04 18:38:22 +02:00
711ce2ac65
Add support for SCRAM-SHA-1-PLUS and SCRAM-SHA-256-PLUS
Extended SMTP tests to include SCRAM-SHA-1-PLUS and SCRAM-SHA-256-PLUS authentication mechanisms. Adjusted the `startSMTPServer` function to accept a hashing function and modified the server logic to handle TLS channel binding.
2024-10-04 18:31:58 +02:00
84f562554c
Merge pull request #322 from wneessen/gh-workflow-updates
Update GitHub Actions paths for Go and workflow files
2024-10-04 15:33:44 +02:00
d931050a6f
Update GitHub Actions paths for Go and workflow files
This commit refines the paths in GitHub Actions workflows to more precisely track changes in Go-related files and specific workflow files. General `.github/**` paths have been replaced with explicit references to relevant workflow files within `.github/workflows`.
2024-10-04 15:28:22 +02:00
04023a1a25
Merge pull request #321 from wneessen/dependabot/github_actions/github/codeql-action-3.26.11
Bump github/codeql-action from 3.26.10 to 3.26.11
2024-10-04 15:23:46 +02:00
dependabot[bot]
fe36f3b294
Bump github/codeql-action from 3.26.10 to 3.26.11
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.10 to 3.26.11.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](e2b3eafc8d...6db8d6351f)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-04 13:17:57 +00:00
28103ede26
Merge pull request #319 from wneessen/codecov-testing
Update GH test workflows
2024-10-03 16:15:19 +02:00
19dcba620a
Remove redundant steps from Cirrus CI configuration
Eliminated unnecessary environment variables and pkg update step to streamline the CI process. Simplified the test script by removing verbose flag from the go test command.
2024-10-03 16:15:07 +02:00
6f10892d0b
Reduce Go versions in Codecov workflow to only 1.23
This commit updates the Codecov GitHub Actions workflow to run only on Go version 1.23, removing support for 1.19 and 1.20. Simplifying to a single Go version aims to streamline the testing process and reduce potential compatibility issues.
2024-10-03 16:01:58 +02:00
8f596ffae7
Add offline tests workflow and clean up SonarQube config
Introduce a new offline tests workflow to validate Go code across multiple OS and Go versions. This commit also removes unused environment variables and updates the Go version syntax in the SonarQube workflow.
2024-10-03 16:00:58 +02:00
f80b4dd8ac
Merge pull request #318 from wneessen/dependabot/github_actions/golangci/golangci-lint-action-6.1.1
Bump golangci/golangci-lint-action from 6.1.0 to 6.1.1
2024-10-03 15:44:55 +02:00
dependabot[bot]
94ed5646c5
Bump golangci/golangci-lint-action from 6.1.0 to 6.1.1
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6.1.0 to 6.1.1.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](aaa42aa062...971e284b60)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-03 13:39:45 +00:00
ff5454a61f
Merge pull request #317 from wneessen/more-auth-test-coverage
More test coverage for smtp/auth
2024-10-03 12:41:28 +02:00
4c8c0d855e
Handle read errors in SMTP authentication flow
Add checks to handle errors when reading client messages. This ensures that an appropriate error message is sent back to the client if reading fails, improving the robustness of the SMTP authentication process.
2024-10-03 12:38:39 +02:00
03062c5183
Add SCRAM-SHA authentication tests for SMTP
Introduce new unit tests to verify SCRAM-SHA-1 and SCRAM-SHA-256 authentication for the SMTP client. These tests cover both successful and failing authentication cases, and include a mock SMTP server to facilitate testing.
2024-10-03 12:32:06 +02:00
a8e89a1258
Add support for SCRAM-SHA authentication mechanisms
Introduced new test cases for SCRAM-SHA-1, SCRAM-SHA-256, and their PLUS variants in `smtp_test.go`. Updated the authTest structure to include a `hasNonce` flag and implemented logic to handle nonce validation and success message processing.
2024-10-02 18:02:46 +02:00
e4dd62475a
Improve error handling in SCRAM-SHA-X-PLUS authentication
Refactor error return to include more specific information and add a check for TLS connection state in SCRAM-SHA-X-PLUS authentication flow. This ensures clearer error messages and verifies essential prerequisites for secure authentication.
2024-10-02 18:02:34 +02:00
580981b158
Refactor error handling in SMTP authentication
Centralized error definitions in `smtp/auth.go` and updated references in `auth_login.go` and `auth_plain.go`. This improves code maintainability and error consistency across the package.
2024-10-02 18:02:23 +02:00
a41639ec07
Fix secret reference and improve test command options
Corrected the reference for `TEST_PASS_SCRAM` in both workflows. Simplified the Go test command in `codecov.yml` and added the `shuffle=on` option for better test randomness in `sonarqube.yml`.
2024-10-02 16:50:45 +02:00
d19c2fd87d
Merge pull request #316 from wneessen/trashmail-update
Update test recipient email in client tests
2024-10-02 16:29:13 +02:00
c8a8e9772a
Update test recipient email in client tests
Changed the test email address from go-mail@mytrashmailer.com to couttifaddebro-1473@yopmail.com. This new address is expected to be used for sending test mails.
2024-10-02 16:25:41 +02:00