Commit graph

1342 commits

Author SHA1 Message Date
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
26f1ed3102
Merge pull request #362 from wneessen/fix-spelling
Fix spelling in some tests
2024-11-11 20:12:46 +01:00
29794fd6ad
Fix typo in Content-Disposition header in tests
Corrected multiple instances of the misspelled "Content-Dispositon" to "Content-Disposition" in the msgwriter_test.go file. This ensures that the error messages in the tests are accurate and improve code readability.
2024-11-11 20:08:58 +01:00
c7438a974c
Fix typos: change "non-existant" to "non-existent"
Corrected multiple instances of the word "non-existant" to "non-existent" in test descriptions to improve code clarity and accuracy. This change affects both smtp_test.go and msg_test.go files.
2024-11-11 20:07:55 +01:00
79d4c6fd07
Correct spelling errors in email validation comments
Fixed the spelling of "dot-separated" in comment explanations to ensure clarity. This makes the comments more accurate and easier to understand.
2024-11-11 20:06:47 +01:00
ad86c7ac4f
Correct typo in test name
The test name had a typo in the word "recipient." This commit corrects "recepient" to "recipient" to improve code readability and maintain consistency in naming conventions. This change does not modify any functional behavior of the tests.
2024-11-11 20:06:07 +01:00
580ef5ed48
Merge pull request #361 from wneessen/smtp-client-tests
SMTP client tests overhaul
2024-11-11 19:57:31 +01:00