Commit graph

1432 commits

Author SHA1 Message Date
Michael Fuchs
e3fb10d897
Merge branch 'main' into main 2024-12-07 13:11:45 +01:00
theexiile1305
7e0511407b feat: using sha256 instead of sha1 2024-12-07 12:43:48 +01:00
8646857fa8
Merge pull request #397 from wneessen/dependabot/github_actions/codecov/codecov-action-5.1.1
Bump codecov/codecov-action from 5.0.7 to 5.1.1
2024-12-06 15:08:29 +01:00
dependabot[bot]
a66e63d974
Bump codecov/codecov-action from 5.0.7 to 5.1.1
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.0.7 to 5.1.1.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](015f24e681...7f8b4b4bde)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-06 13:35:21 +00:00
9db600a55b
Merge pull request #395 from wneessen/dependabot/go_modules/golang.org/x/crypto-0.30.0
Bump golang.org/x/crypto from 0.29.0 to 0.30.0
2024-12-05 15:01:26 +01:00
dependabot[bot]
37b396be44
Bump golang.org/x/crypto from 0.29.0 to 0.30.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.29.0 to 0.30.0.
- [Commits](https://github.com/golang/crypto/compare/v0.29.0...v0.30.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-05 13:59:26 +00:00
0922360bd8
Merge pull request #396 from wneessen/dependabot/go_modules/golang.org/x/text-0.21.0
Bump golang.org/x/text from 0.20.0 to 0.21.0
2024-12-05 14:58:21 +01:00
dependabot[bot]
bc46e064c8
Bump golang.org/x/text from 0.20.0 to 0.21.0
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.20.0 to 0.21.0.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.20.0...v0.21.0)

---
updated-dependencies:
- dependency-name: golang.org/x/text
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-05 13:19:33 +00:00
65f4a46237
Merge pull request #394 from wneessen/dependabot/github_actions/github/codeql-action-3.27.6
Bump github/codeql-action from 3.27.5 to 3.27.6
2024-12-03 15:30:33 +01:00
dependabot[bot]
2faeadff6d
Bump github/codeql-action from 3.27.5 to 3.27.6
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.27.5 to 3.27.6.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](f09c1c0a94...aa57810251)

---
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-12-03 13:55:59 +00:00
d2dc4af930
Merge pull request #393 from wneessen/dependabot/github_actions/sonarsource/sonarqube-scan-action-4.1.0
Bump sonarsource/sonarqube-scan-action from 4.0.0 to 4.1.0
2024-12-02 16:35:28 +01:00
dependabot[bot]
fb63a50a9c
Bump sonarsource/sonarqube-scan-action from 4.0.0 to 4.1.0
Bumps [sonarsource/sonarqube-scan-action](https://github.com/sonarsource/sonarqube-scan-action) from 4.0.0 to 4.1.0.
- [Release notes](https://github.com/sonarsource/sonarqube-scan-action/releases)
- [Commits](94d4f8ac4a...1b442ee39a)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-02 15:31:16 +00:00
976a2943e3
Merge pull request #391 from step-security-bot/stepsecurity_remediation_1732996653
[StepSecurity] ci: Harden GitHub Actions
2024-11-30 21:02:00 +01:00
StepSecurity Bot
eb4f53a9fb
[StepSecurity] ci: Harden GitHub Actions
Signed-off-by: StepSecurity Bot <bot@stepsecurity.io>
2024-11-30 19:57:35 +00:00
acf3c58220
Merge pull request #388 from wneessen/bug/filename-sanitization
Improve filename sanitization in MIME headers
2024-11-26 16:45:04 +01:00
06bee90a1e
Remove charset from octet-stream Content-Type on FreeBSD
The charset parameter in the Content-Type header for octet-stream files on FreeBSD was removed. This aligns the behavior with the expected MIME type format for such files. Other platforms remain unchanged.
2024-11-26 16:38:30 +01:00
f61da9cc2e
Update content-type handling for FreeBSD in msgwriter test
Adjusted the expected content-type header in msgwriter tests to account for FreeBSD by setting it to 'application/octet-stream' instead of 'text/plain'. This ensures compatibility and correct behavior across different operating systems.
2024-11-26 16:34:09 +01:00
75c0e3319b
Simplify attachment test setup
Removed temporary file creation and copying in msgwriter_test.go. Directly attach the source file during the test to streamline the setup process. This change reduces complexity and potential points of failure in the test code.
2024-11-26 16:26:13 +01:00
fe765cd49e
Add filename sanitization tests for attachments
Introduced tests to validate filename sanitization for attachments, ensuring disallowed characters are handled correctly. These tests cover various scenarios, including different character sets such as Japanese, Chinese, and Cyrillic.
2024-11-26 16:17:34 +01:00
b051471f8d
Add tests for the sanitizeFilename function
This commit introduces a series of tests for the sanitizeFilename function in msgwriter_test.go. The tests cover various edge cases to ensure filenames are sanitized correctly by replacing or removing invalid characters. These additions will help maintain the integrity and reliability of filename sanitization in the codebase.
2024-11-26 12:02:15 +01:00
8f8b5079c3
Improve filename sanitization in MIME headers
Sanitize filenames to replace invalid characters before encoding them. This prevents control and special characters from causing issues in MIME headers and file systems. The `sanitizeFilename` function ensures these characters are replaced with underscores.
2024-11-26 11:37:26 +01:00
fe53c86338
Merge pull request #387 from wneessen/bug/fix-comment
Remove unused opts parameter docstring
2024-11-24 12:26:31 +01:00
2f08829fa3
Remove unused opts parameter docstring
The opts parameter documentation was removed as it is no longer used in the quicksend function. This change helps in maintaining accurate and up-to-date code documentation and reduces potential confusion.
2024-11-24 12:25:37 +01:00
ead4067f2d
Merge pull request #386 from wneessen/bug/385_concurrency-issue-in-dialandsendwithcontext
Fix concurrency issue in DialAndSendWithContext
2024-11-22 16:36:10 +01:00
6ebc60d1df
Remove redundant nil check for SMTP client
The removed check for a nil SMTP client was redundant because the previous error handling already covers this case. Streamlining this part of the code improves readability and reduces unnecessary checks.
2024-11-22 16:22:53 +01:00
c61aad4fcb
Remove extra blank line in client_test.go
This change removes an unnecessary blank line at the end of the TestClient_sendSingleMsg function in the client_test.go file. Keeping the code clean and properly formatted improves readability and maintainability.
2024-11-22 16:22:38 +01:00
b4d3b165ed
Add test for dialing SMTP client with context
Introduce a new test, `TestClient_DialToSMTPClientWithContext`, to verify client behavior when establishing and closing an SMTP connection with context handling. Also added a sub-test to simulate and confirm failure scenarios during SMTP connection establishment.
2024-11-22 16:21:49 +01:00
7aba5212c4
Rename method and improve context handling
Renamed `SMTPClientFromDialWithContext` to `DialToSMTPClientWithContext` for clarity and consistency. Updated method parameters and documentation to standardize context usage across the codebase.
2024-11-22 16:06:28 +01:00
4c107f4645
Refactor Client methods to handle smtp.Client parameter
Updated several Client methods to accept a smtp.Client pointer, allowing for more flexible and explicit SMTP client management. Added detailed parameter descriptions and extended error handling documentation.
2024-11-22 15:55:45 +01:00
3553b65769
Add new Send function to client.go and remove duplicates
The new Send function in client.go adds thread safety by using a mutex. This change also removes duplicate Send functions from client_119.go and client_120.go, consolidating the logic in one place for easier maintenance.
2024-11-22 15:38:04 +01:00
3e504e6338
Lock sendMutex to ensure thread safety in Send
Added a mutex lock and unlock around the Send function to prevent concurrent access issues and ensure thread safety. This change helps avoid race conditions when multiple goroutines attempt to send messages simultaneously.
2024-11-22 15:29:31 +01:00
be4201b05a
Refactor debug logging and logger settings in Client
Separated debug logging and logger setting methods to include SMTP client parameter for better encapsulation. Removed commented-out code for cleaner and more manageable codebase.
2024-11-22 15:29:22 +01:00
55884786be
Refactor SMTP client functions to improve modularity
Refactor `DialWithContext` to delegate client creation to `SMTPClientFromDialWithContext`. Add new methods `SendWithSMTPClient`, `CloseWithSMTPClient`, and `ResetWithSMTPClient` to handle specific actions on `smtp.Client`. Simplify `auth`, `sendSingleMsg`, and `tls` methods by passing client as parameters.
2024-11-22 14:59:19 +01:00
f9e869061e
Add mutex locks to DSN option setters
Mutex locks are added to ensure thread safety when setting DSN mail return and recipient notify options. This prevents data races in concurrent environments, improving the client's robustness.
2024-11-22 14:58:41 +01:00
45776c052f
Refactor client error handling and add concurrent send tests
Updated tests to correctly assert the absence of an SMTP client on failure. Added concurrent sending tests for DialAndSendWithContext to improve test coverage and reliability. Also, refined the `AutoDiscover` and other client methods to ensure proper parameter use.
2024-11-22 14:58:05 +01:00
bc5d98031b
Merge pull request #384 from wneessen/dependabot/github_actions/github/codeql-action-3.27.5
Bump github/codeql-action from 3.27.4 to 3.27.5
2024-11-21 15:07:48 +01:00
c217f032bc
Merge pull request #383 from wneessen/dependabot/github_actions/codecov/codecov-action-5.0.7
Bump codecov/codecov-action from 5.0.4 to 5.0.7
2024-11-21 15:03:17 +01:00
d6c96dcd3d
Merge pull request #382 from wneessen/dependabot/github_actions/actions/dependency-review-action-4.5.0
Bump actions/dependency-review-action from 4.4.0 to 4.5.0
2024-11-21 15:03:03 +01:00
dependabot[bot]
62b3314c20
Bump github/codeql-action from 3.27.4 to 3.27.5
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.27.4 to 3.27.5.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](ea9e4e3799...f09c1c0a94)

---
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-21 14:02:21 +00:00
dependabot[bot]
49606f197b
Bump codecov/codecov-action from 5.0.4 to 5.0.7
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.0.4 to 5.0.7.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](985343d705...015f24e681)

---
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-21 14:02:09 +00:00
dependabot[bot]
e17965a891
Bump actions/dependency-review-action from 4.4.0 to 4.5.0
Bumps [actions/dependency-review-action](https://github.com/actions/dependency-review-action) from 4.4.0 to 4.5.0.
- [Release notes](https://github.com/actions/dependency-review-action/releases)
- [Commits](4081bf99e2...3b139cfc5f)

---
updated-dependencies:
- dependency-name: actions/dependency-review-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-21 14:02:01 +00:00
d00969886a
Merge pull request #381 from wneessen/bug/380_use-of-closed-network-connection-error-when-using-concurrently
Add mutex for concurrent send protection
2024-11-21 10:38:09 +01:00
6e9df0b724
Increase timeout for DialAndSend context
Updated the timeout for the DialAndSend context in 'client_test.go' from 5 seconds to 1 minute to ensure sufficient time for the operation to complete. This change helps prevent premature timeouts that can cause test failures.
2024-11-21 10:33:24 +01:00
1a579c2149
Add mutex for concurrent send protection
Introduced a sendMutex to synchronize access to shared resources in the DialAndSendWithContext method. This ensures thread safety when sending multiple messages concurrently. Added a corresponding test to verify the concurrent sending functionality.
2024-11-21 10:26:48 +01:00
181539f8fd
Merge pull request #379 from wneessen/dependabot/github_actions/codecov/codecov-action-5.0.4
Bump codecov/codecov-action from 5.0.2 to 5.0.4
2024-11-20 14:51:16 +01:00
dependabot[bot]
b1a294d364
Bump codecov/codecov-action from 5.0.2 to 5.0.4
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.0.2 to 5.0.4.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](5c47607acb...985343d705)

---
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-20 13:12:42 +00:00
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