Replacing ssmtp with nullmailer ensures better compatibility with the updated email delivery requirements. The DEBIAN_FRONTEND=noninteractive parameter was also added to avoid interactive prompts during installation.
Previously, the apt-get commands lacked the necessary sudo prefix, which could lead to permission issues during the CI process. This change ensures that updates, upgrades, and installations are executed with the appropriate permissions.
Add the TEST_SENDMAIL environment variable for better control over sendmail tests. Optimize sendmail installation in CI by updating and installing ssmtp. Modify tests to check if TEST_SENDMAIL is set to "true" before running.
This commit updates the CI configuration to no longer test against Go versions 1.19 and 1.20. The supported Go versions are now 1.21, 1.22, and 1.23, ensuring the CI pipeline aligns with our current support policy.
This change adds SPDX license headers to the .github/workflows/ci.yml file to ensure proper attribution and compliance with the MIT license. The added headers include copyright information and the applicable license type.
This change modifies the concurrency group names to include OS and Go version for better differentiation. This prevents conflicts and ensures that concurrent jobs are properly managed based on their specific matrices.
Ensure CI workflow has access to the latest code by adding a checkout step. This change is necessary for the golangci-lint action to function correctly with the most recent codebase.
This ensures the lint and vulnerability check steps run on the 'ubuntu-latest' environment. Establishing a clear execution environment helps maintain consistency across CI runs.
This change specifies that the dependency review job should run on the latest version of Ubuntu. It ensures consistency and clarity in the workflow configuration. This modification helps avoid potential issues related to unspecified runner environments.
Removed test cases for IPv6 and IPv4 addresses from `msg_test.go` as they are no longer required. Also made a minor formatting adjustment to the `checkAddrHeader` function signature for better readability.
Removed file path filters on branch triggers in the CI workflow configuration. This allows the CI to run for any changes made in the main branch, ensuring broader test coverage and catching issues early.
Merged separate workflows for Codecov, dependency-review, golangci-lint, govulncheck, offline-tests, reuse compliance, and SonarQube into a unified CI workflow file in `.github/workflows/ci.yml`. This restructuring simplifies our CI setup and ensures more consistent and efficient pipeline management.
Consolidate repeated header validation logic into the `checkAddrHeader` helper function. This refactoring improves code readability and maintainability by reducing redundancy and potential for errors.
Replace repeated address header validation code with a helper function `checkAddrHeader` to reduce redundancy and improve readability. Also, add new test cases for `ToFromString` to handle valid addresses with and without empty fields.
Previously, the ToFromString function split email addresses by commas but did not handle empty addresses or trim whitespace. Now, it trims each address and ignores any empty entries to ensure only valid addresses are processed. This prevents potential errors stemming from malformed input.
Introduces new test cases to verify the Msg_ToIgnoreInvalid function handles various scenarios correctly. These tests check for behavior with valid addresses, invalid addresses, and a mix of both.
Introduce a new, empty test function `TestMsg_ToIgnoreInvalid` in `msg_test.go` to accommodate future test cases. This commit also aligns a comment for better readability.
Introduced new test cases to validate Msg.AddToFormat functionality with both valid and invalid email addresses. Ensured proper error handling and address formatting in the message headers.
Corrected incorrect address references in the `msg_test.go` file. Added new tests to validate the AddTo functionality, ensuring multiple addresses can be added and validated properly.
This change adds `//goland:noinspection GoDeprecation` comments in the `msg_test.go` file. These comments suppress deprecation warnings for the `SetHeader` and `SetHeaderPreformatted` methods during test execution.
Refactor "From" related tests to improve error messages and add tests for the new "FromFormat" function. Introduce new tests to validate the "To" address handling, covering various valid and invalid address scenarios.
Implemented extensive test cases for the "From" field in email messages, covering various valid and invalid email formats according to RFC5322. Verified correct handling for each scenario to ensure robustness of email address validation.
Implemented comprehensive tests for the EnvelopeFrom and EnvelopeFromFormat methods to ensure proper handling of valid and invalid email addresses. This includes validation of both address and format for the "EnvelopeFrom" header.
Renamed existing test cases for clarity and added new test cases for SetAddrHeaderIgnoreInvalid function. The new tests cover multiple scenarios including valid/invalid addresses, and edge cases such as nil addrHeader map.
This commit ensures that the address header map is properly initialized before assigning addresses to it. Additionally, it enforces the rule that only a single 'From' address is allowed, preventing multiple addresses from being set for the 'From' header. These misses were found while working on the enhanced testing suite
Implemented extensive unit tests for setting various headers and address fields in the `Msg` struct, including setting general headers, preformatted headers, and address headers with various scenarios to ensure correctness and robustness.
Simplify test structure by renaming fields for clarity and brevity. AddressHeader tests and importance tests now use more concise and consistent naming conventions. This enhances readability and maintainability of the test code.
Updated test cases to use a predefined context instead of creating new backgrounds. Additionally, improved error handling by checking for client creation failures and adding appropriate fatal log messages. These changes enhance test reliability and debugging clarity.
This commit introduces two new unit tests: `TestMsg_Charset` and `TestMsg_SetHeader`. These tests cover the functionality of setting and retrieving the character set and headers for messages, ensuring correctness and robustness.
Consolidate repetitive test case definitions into separate slices for readability and maintainability. This change simplifies the addition of new test cases and reduces redundancy.
Reformat test cases in `client_test.go` for better readability and consistency by converting single-line struct definitions into multi-line blocks. This change improves code maintainability and aligns the formatting across similar tests.
Consolidated repetitive test data into shared variables to improve code maintainability and readability. This modification also helps in reducing redundancy and streamlining future updates to test data.
Reorganized and condensed test cases for the NewMsg method by merging individual tests and removing obsolete functions. This improves maintainability and reduces duplication in the test suite.
Renamed test functions from `TestHeader_String` to `TestHeader_Stringer` and `TestAddrHeader_String` to `TestAddrHeader_Stringer` for consistency. Additionally, added new header cases such as "Content-Description" and "X-Auto-Response-Suppress" to improve test coverage.
Separated test cases for String, NumString, and XPrioString methods of the Importance object into distinct sub-tests. Improved readability and maintainability by grouping similar assertions together.
Reintegrates previously commented out tests for file content types, ensuring they are part of a structured t.Run block. Enhances readability and maintains functionality by checking the presence and correctness of attachments in a more concise manner.
I reported the bug I fixed in 74fa3f6f62 to Go upstream. They fixed simpler by just ignoring the error (See: https://go.dev/cl/622476). We follow this patch accordingly. The upstream test has been adopted as well.
Consolidate multiple test functions into a single TestFile function using subtests. This improves test organization and enhances readability. Added a new test case for testing file name attachment.
Introduced a series of test cases for validating EML parsing against different edge cases, including invalid headers, content types, and transfer encodings. Ensured both valid and invalid EML strings are covered to thoroughly test the robustness of the parser.
Correct the variable assignment in the `if err` statement to ensure proper error handling. This change eliminates a potential bug where the wrong variable might be used.
Introduce new EML files with valid and invalid examples. Implement tests for EML parsing from readers and files, checking for both successful parsing and expected failures on invalid inputs.
The error variable declaration has been corrected from "if err := parseEML(...)" to "if err = parseEML(...)". This change ensures consistency with the rest of the error handling code in the file.
Removed obsolete and redundant client test cases that were no longer relevant. This cleanup improves code maintainability and readability by eliminating excessive, unused test methods.