Commit graph

1348 commits

Author SHA1 Message Date
9410381bfc
Merge pull request #378 from wneessen/feature/quicksend
Add QuickSend feature
2024-11-19 17:46:22 +01:00
f05654d5e5
Add exclusion rule for TLS settings in tests
Updated the .golangci.toml config to exclude gosec rule G402 in quicksend_test.go. This exclusion is intentional as these tests do not require TLS settings.
2024-11-19 17:29:37 +01:00
7ee4e47c8e
Add EchoBuffer to serverProps for capturing SMTP data
Introduced a new io.Writer field `EchoBuffer` and its associated `BufferMutex` to `serverProps`. Updated relevant test code to write SMTP transaction data to `EchoBuffer` if it is set, ensuring thread safety with `BufferMutex`.
2024-11-19 17:29:26 +01:00
d30a4a73c6
Add QuickSend function and unit tests
Introduce the QuickSend function for sending emails quickly with TLS and optional SMTP authentication. Added comprehensive unit tests to ensure QuickSend works correctly with different authentication mechanisms and handles various error scenarios.
2024-11-19 17:29:17 +01:00
25a0fb23a9
Merge pull request #377 from wneessen/dependabot/github_actions/step-security/harden-runner-2.10.2
Bump step-security/harden-runner from 2.10.1 to 2.10.2
2024-11-19 15:13:14 +01:00
dependabot[bot]
93fc646338
Bump step-security/harden-runner from 2.10.1 to 2.10.2
Bumps [step-security/harden-runner](https://github.com/step-security/harden-runner) from 2.10.1 to 2.10.2.
- [Release notes](https://github.com/step-security/harden-runner/releases)
- [Commits](91182cccc0...0080882f6c)

---
updated-dependencies:
- dependency-name: step-security/harden-runner
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-19 13:32:14 +00:00
f37ab2457b
Merge pull request #376 from wneessen/feature/embed-fs-to-io-fs
Support attachments/embeds via io/fs.FS
2024-11-19 11:00:14 +01:00
101a35f7d3
Add AttachFromIOFS and EmbedFromIOFS functions
Introduce new methods AttachFromIOFS and EmbedFromIOFS to handle attachments and embeds from a general file system (fs.FS). Updated tests to cover these new functionalities and modified error messages for consistency. Updated README to reflect support for fs.FS.
2024-11-19 10:52:54 +01:00
b137fe4611
Refactor file handling to use io/fs interface
Updated functions to use the io/fs package instead of embed.FS, making the code more flexible with respect to different filesystem implementations. Revised the method signatures and related documentation to reflect this change.
2024-11-18 16:44:00 +01:00
bcc32526b7
Merge pull request #375 from wneessen/dependabot/github_actions/codecov/codecov-action-5.0.2
Bump codecov/codecov-action from 5.0.1 to 5.0.2
2024-11-18 15:26:26 +01:00
dependabot[bot]
95ae33255f
Bump codecov/codecov-action from 5.0.1 to 5.0.2
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.0.1 to 5.0.2.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](3b1354a6c4...5c47607acb)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-18 13:46:16 +00:00
0c1908d7bf
Merge pull request #374 from wneessen/feature/auth-autodisover-unmarshal
Add support for SMTP auto-discovery authentication
2024-11-16 22:10:51 +01:00
f296f53c1e
Add support for SMTP auto-discovery authentication
Extended the `UnmarshalString` function in `auth.go` to recognize "auto", "autodiscover", and "autodiscovery" as `SMTPAuthAutoDiscover`. Corresponding test cases were also added to `auth_test.go` to ensure proper functionality.
2024-11-16 21:58:58 +01:00
c37ed7c723
Merge pull request #373 from wneessen/feature/smtp-auth-autoselect
Add SMTP authentication auto-discovery
2024-11-16 21:51:23 +01:00
d8df26bbc8
Fix regression 2024-11-16 21:46:46 +01:00
427e8fd1ed
Format code block consistently
Refactor the `preferList` definition in `client.go` for improved readability and consistency. This change ensures the code aligns with standard formatting practices.
2024-11-16 21:41:32 +01:00
6d3640a166
Fix auth type auto-discovery and add test cases
Refactor the auth type initialization to prevent incorrect assignments and handle empty supported lists. Added comprehensive test cases to verify auto-discovery selection of the strongest authentication method and ensure robustness against empty or invalid input.
2024-11-16 21:38:29 +01:00
ac9117dc50
Add SMTP authentication auto-discovery
Implemented a mechanism to automatically discover and select the strongest supported SMTP authentication type. This feature simplifies the authentication process for users and enhances security by prioritizing stronger mechanisms based on server capabilities. Corresponding tests and documentation have been updated.
2024-11-16 14:29:34 +01:00
a4fa95f7ca
Merge pull request #371 from wneessen/dependabot/github_actions/codecov/codecov-action-5.0.1
Bump codecov/codecov-action from 4.6.0 to 5.0.1
2024-11-15 16:08:58 +01:00
266f0b36ec
Merge pull request #372 from wneessen/dependabot/github_actions/github/codeql-action-3.27.4
Bump github/codeql-action from 3.27.3 to 3.27.4
2024-11-15 16:08:37 +01:00
dependabot[bot]
1cddf5bc76
Bump github/codeql-action from 3.27.3 to 3.27.4
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.27.3 to 3.27.4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](396bb3e453...ea9e4e3799)

---
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-11-15 14:02:51 +00:00
dependabot[bot]
7210d679db
Bump codecov/codecov-action from 4.6.0 to 5.0.1
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4.6.0 to 5.0.1.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](b9fd7d16f6...3b1354a6c4)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-15 14:02:43 +00:00
e8b41f4a81
Merge pull request #370 from wneessen/feature/golangci-lint-gosec
Enable gosec linter and add exclusion rules
2024-11-15 12:38:55 +01:00
6fbb88239f
Enable gosec linter and add exclusion rules
Added gosec to the list of enabled linters in `.golangci.toml`. Defined specific exclusion rules to ignore certain false positives and context-specific issues flagged by gosec, ensuring the linter does not impose on intentional code practices.
2024-11-15 12:35:15 +01:00
441d163e38
Merge pull request #369 from wneessen/dependabot/github_actions/fsfe/reuse-action-5.0.0
Bump fsfe/reuse-action from 4.0.0 to 5.0.0
2024-11-14 14:55:16 +01:00
dependabot[bot]
1a811f3bcf
Bump fsfe/reuse-action from 4.0.0 to 5.0.0
Bumps [fsfe/reuse-action](https://github.com/fsfe/reuse-action) from 4.0.0 to 5.0.0.
- [Release notes](https://github.com/fsfe/reuse-action/releases)
- [Commits](3ae3c6bdf1...bb774aa972)

---
updated-dependencies:
- dependency-name: fsfe/reuse-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-14 13:50:11 +00:00
da6bf26405
Merge pull request #368 from wneessen/feature/365_expose-error-code-in-senderror
Expose error code in SendError
2024-11-14 10:49:59 +01:00
2bde340428
Update SMTP test port variable and CI configuration
Changed the SMTP test server base port and updated the corresponding environment variable name to `TEST_BASEPORT_SMTP`. This ensures consistency across the test setup and CI workflow configuration.
2024-11-14 10:45:35 +01:00
a70dde5a4d
Add TEST_BASEPORT environment variable to CI workflow
In the CI configuration file, the TEST_BASEPORT environment variable was added to various job scopes. This ensures consistency and allows the test base port to be set properly across different OS versions and Go versions.
2024-11-14 10:41:10 +01:00
ca3f50552e
Allow configuration of test server port via environment variable
Moved TestServerPortBase initialization to use an environment variable `TEST_BASEPORT` if provided. This adjustment helps in specifying custom base ports for running tests, ensuring better flexibility in different testing environments.
2024-11-14 10:36:24 +01:00
bd655b768b
Refactor SendError initialization for better readability
Structured the initialization of SendError on connection errors to improve code readability and maintainability. This change affects the error handling in both client_120.go and client_119.go by spreading the error details across multiple lines.
2024-11-14 10:20:52 +01:00
c8d7cf86e1
Enhance error handling in Client's Send method
Added support for Enhanced Status Codes (ESC) when checking the SMTP client's extensions. The SendError struct now includes the error code and enhanced status code for improved diagnostics.
2024-11-14 10:17:18 +01:00
a5ac7c3370
Update error handling to include error code and status
Previously, only the isTemp flag was considered when aggregating errors. Now, the error code and enhanced status code from the last error are also included. This ensures more comprehensive error reporting and handling.
2024-11-13 23:04:39 +01:00
719e5b217c
Enhance error handling with ENHANCEDSTATUSCODES check
Added a check for the ENHANCEDSTATUSCODES extension and included error code and enhanced status code information in SendError. This helps in providing more detailed error reporting and troubleshooting.
2024-11-13 23:02:30 +01:00
f367db0278
Refactor error code functions and add enhanced status code tests
Renamed `getErrorCode` function to `errorCode` for consistency. Added new tests for the `enhancedStatusCode` function to validate its behavior with various error scenarios.
2024-11-13 22:53:18 +01:00
6268acac44
Refactor error handling by renaming functions.
Renamed `getErrorCode` to `errorCode` and `getEnhancedStatusCode` to `enhancedStatusCode` for consistency. Updated all references in `client.go` and `senderror.go` accordingly, improving readability and maintaining uniformity across the codebase.
2024-11-13 22:47:53 +01:00
e8fb977afe
Add tests for getErrorCode function
Introduce a suite of unit tests for the getErrorCode function to validate its behavior with various error types, including go-mail errors, permanent and temporary errors, wrapper errors, non-4xx/5xx errors, and non-3-digit codes.
2024-11-13 21:48:24 +01:00
615155bfc2
Add tests for SendError's enhanced status and error codes
Implemented new unit tests for SendError to validate the enhanced status code and error codes in various scenarios, including nil SendError cases, errors with no enhanced status code, and errors with both permanent and temporary error codes. This ensures the correctness of the error handling behavior across different conditions.
2024-11-13 21:27:27 +01:00
ad265cac57
Add ErrorCode method to SendError
Implemented ErrorCode method to retrieve the error code from the server response in SendError. This method distinguishes between server-generated errors and client-generated errors, returning 0 for errors generated by the client.
2024-11-13 21:26:11 +01:00
b9d9449252
Change test server port base for SMTP client tests
Updated the TestServerPortBase from 12025 to 30025 to avoid port conflicts with other services running on the common 12025 port. This adjustment aims to ensure that the tests run reliably in diverse environments.
2024-11-13 21:25:39 +01:00
6809084e80
Add enhanced status code and error code to SendError
Enhance error handling by adding error code and enhanced status code to the SendError struct. This allows for better troubleshooting and debugging by providing more detailed SMTP server responses.
2024-11-13 16:11:28 +01:00
29ad32e6d0
Merge pull request #366 from wneessen/dependabot/github_actions/sonarsource/sonarqube-scan-action-4.0.0
Bump sonarsource/sonarqube-scan-action from 3.1.0 to 4.0.0
2024-11-13 14:40:23 +01:00
d03c476fb7
Merge pull request #367 from wneessen/dependabot/github_actions/github/codeql-action-3.27.3
Bump github/codeql-action from 3.27.2 to 3.27.3
2024-11-13 14:40:04 +01:00
dependabot[bot]
2f97ebabd3
Bump github/codeql-action from 3.27.2 to 3.27.3
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.27.2 to 3.27.3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](9278e42166...396bb3e453)

---
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-11-13 13:31:52 +00:00
dependabot[bot]
ea70b21c90
Bump sonarsource/sonarqube-scan-action from 3.1.0 to 4.0.0
Bumps [sonarsource/sonarqube-scan-action](https://github.com/sonarsource/sonarqube-scan-action) from 3.1.0 to 4.0.0.
- [Release notes](https://github.com/sonarsource/sonarqube-scan-action/releases)
- [Commits](13990a6956...94d4f8ac4a)

---
updated-dependencies:
- dependency-name: sonarsource/sonarqube-scan-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-13 13:31:45 +00:00
37ac2de2af
Merge pull request #364 from wneessen/dependabot/github_actions/github/codeql-action-3.27.2
Bump github/codeql-action from 3.27.1 to 3.27.2
2024-11-12 14:15:58 +01:00
dependabot[bot]
cff789883f
Bump github/codeql-action from 3.27.1 to 3.27.2
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.27.1 to 3.27.2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](4f3212b617...9278e42166)

---
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-11-12 13:13:53 +00:00
6c06c459da
Update README.md SMTP features and TLS support details
Revised the documentation for greater clarity: swapped the listed items for explicit and implicit SSL/TLS support, and detailed the supported SMTP authentication mechanisms in an itemized format. This ensures users understand all available options and configurations more clearly.
2024-11-11 20:23:42 +01:00
ccc104973e
Merge pull request #363 from wneessen/simplify-license
Remove CC0-1.0 license
2024-11-11 20:19:34 +01:00
935a523fa7
Change license to MIT
Updated SPDX identifiers from CC0-1.0 to MIT across multiple files, including `.github`, `CONTRIBUTING.md`, `README.md`, and more. Deleted the `LICENSES/CC0-1.0.txt` file as it is no longer relevant.
2024-11-11 20:16:09 +01:00