Skip to content

v0.7.0: Compatiblity changes, EML parser fixes, mail.Address support and more

Choose a tag to compare

@wneessen wneessen released this 12 Sep 13:19
· 22 commits to main since this release
ac1eb03

Welcome to go-mail v0.7.0! 🎉

This release brings important improvements, new features, and fixes to make working with go-mail more reliable and powerful.

Warning

BREAKING CHANGES! This release introduces some changes that might potentially break your code base, so please review carefully before upgrading.

Change in Supported Go Versions

With this release, go-mail will no longer commit to supporting the last four Go versions. Instead, we will follow the official Go release policy and only support versions that are actively maintained by the Go team.

Why this change?

  • Security and Dependencies
    Even though go-mail currently has very few dependencies, keeping support for outdated Go versions would prevent us from safely updating them in the future. This creates the risk of leaving users exposed to unpatched security vulnerabilities and critical issues.

  • Maintenance Costs
    Supporting unsupported Go versions requires extra workarounds, conditionals, and testing overhead. Every additional version increases maintenance complexity and takes valuable time away from adding new features, improving the code base, and fixing bugs.

  • Alignment with the Go Ecosystem
    The Go team provides two releases per year, and each version receives about one year of official support. By aligning with this policy, go-mail ensures that users always benefit from current language features and security patches.

What this means for you

If you are already on a Go version that is actively maintained (at this point: 1.24 or 1.25), nothing changes. If you are on an older, unsupported version, you will not be able to run go-mail v0.7.0 or higher and we strongly encourage upgrading. This will not only allow you to continue using go-mail but will also ensure you benefit from the security and performance improvements provided by the Go team.

Change Reply-To header from generic header type to address header type

|Breaking change| With PR #441 we changed Reply-To header to an AddrHeader type. Since Reply-To is actually an address header which formats the mail address accordingly, and not a generic header, this could lead to potential double encoding if the address and name contain special characters. This change is potentially a breaking change, since we are changing a public type, but as long as the user makes use of msg.ReplyTo() or msg.ReplyToFormat() this should not cause any problems.

Fix "short writes" in Base64LineBreaker and make the type private

|Breaking change| With PRs #445, #448 and #443 we address an issue with the Base64LineBreaker.Write implementation which reports an incorrect count of bytes written ("short writes). While those short writes aren't noticed in practice, since we use base64.Encoder.Encode.Write under the hood, which ignores short writes, the issue was still fixed to make it future-proof against potential changes in the base64 package. This issue was reported and fixed by @dolmen. Thank you very much for your contribution! It was also pointed out, that our Base64LineBreaker was a public type without exposing any public methods, making it unusuable for any 3rd party library. Therefore the Base64LineBreaker type was made private (which in theory is a breaking change, but in practice should not affect any user, given that no public methods were exposed)

EML parsing

The EML parsing was made more robust by introducing several fixes/improvements:

  • Fix nil map assignment in EML parser: PR #447 fixes a bug in the EML parser which was caused by a non-initialized map. Parsing an email could cause a panic: assignment to entry in nil map. This issue was reported by numerous users (see: #446, #462, #468, #482 and #490). Thanks to everybody who reported this issue!
  • Fix multipart header parsing: PR #458 improves the handling of multipart headers by addressing edge cases where multiple parameters are present.
  • Use the original EML boundary instead of generating a new one : PR #491 fixes an issue in which parsed multipart messages would hold two boundary headers, which would render the mail broken. This issue was reported and fixed by @termermc. Thanks for your contribution!

Support for mail.Address types

PR #472 adds support for directly providing *mail.Address instances by providing a SetAddrHeaderFromMailAddress method. It also provides methods for directly providing *mail.Address instances for all the various address types (From, To, CC, BCC, etc.). Additionally it adds a IsAddrHeader method, which checks if the provided string is an address header.

Error handler registry

PR #492 introduces ResponseErrorHandler and ErrorHandlerRegistry - an interface that defines a method for handling SMTP responses that do not comply with expected formats or behaviors and would cause errors during the SMTP communication. It is useful for implementing retry logic, logging, provider-specific error handling. It injects itself into the smtp.Client and is called whenever a server response does fail. This feature addresses #464 and #463. In our Wiki we will collect a currated list of known providers with issues and corresponding code examples on how to implement the error handler.

What's Changed

  • BREAKING CHANGE: Refactor Reply-To header handling. by @wneessen in #441
  • POTENTIAL BREAKING: More Base64LineBreaker fuzzing by @dolmen in #443
  • Fix assignment to nil map in EML parser by @wneessen in #447
  • Make Base64LineBreaker private by @wneessen in #448
  • Fix multipart header parsing and add test for attachments with metadata by @wneessen in #458
  • Fix "short writes" in Base64LineBreaker.Write by @dolmen in #445
  • Update TLS test certificates to use 2048-bit RSA keys by @wneessen in #460
  • Improve PKCS7 test suite by @wneessen in #423
  • Add support for mail.Address instances by @wneessen in #472
  • Add support for server responses by @wneessen in #475
  • Update README compatibility policy for Go versions by @wneessen in #484
  • Refactor codebase to align with updated Go version support by @wneessen in #486
  • When decoding a multipart message from EML, use the original EML boundary instead of generating a new one by @termermc in #491
  • smtp: Implement ErrorHandlerRegistry for handling errors in SMTP responses by @wneessen in #492
  • v0.7.0 release preparation by @wneessen in #493
  • Removed internal PBKDF2 implementation and replaced with Go's stdlib by @wneessen in #494

CI/CD maintenance changes

  • Remove SonarQube integration from CI workflow. by @wneessen in #442
  • Migrate golangci-lint to v2 by @wneessen in #461
  • Update CI configuration to support Go 1.25 and disable older versions by @wneessen in #485
  • Bump golang.org/x/text from 0.22.0 to 0.28.0 by @dependabot[bot] in #481
  • Enable macOS builds in CI test matrix by @wneessen in #487
  • Bump golang.org/x/text from 0.28.0 to 0.29.0 by @dependabot[bot] in #488

New Contributors

Full Changelog: v0.6.2...v0.7.0