This release fixes a bug in the msgWriter error handling as well as introduces the new GetAddrHeader method. Thanks to @oschwald for both, the error report and the feature request.
- The error handling in the
msgWriter.writeBodymethod was not working properly. We basically overwrote themw.errwithnilif the function that followed after a failed write attempt was successful again. SetHeaderandSetHeaderPreformattedhave been deprecated in favour ofSetGenHeaderandSetGenHeaderPreformattedAs pointed out in #80 the naming was pretty confusing, given that we already haveSetAddrHeader.
With the new naming convention it should be more clear to the user, which method to use for which action. For compatibility reasons the old methods have been kept for now but in reality they are just aliases to the new methods.GetAddrHeaderandGetAddrHeaderStringhave been introduced As requested in #80 analogous toGetGenHeaderwe also need a similar method for the address headers. Since address headers are*mail.Addresspointer, we've also added a*Stringmethod that will extract the address string and return a string slice instead.- Additionally we're introducing methods for the actual address headers:
GetTo,GetFrom,GetCcandGetBcc(with a*Stringcounterpart as well). This way the user has full flexibility. Either they use the more "low-level"GetAddrHeadermethod or the higher level methods for the corresponding address type
NOTE; We encourage users who use the SetHeader method in their code to switch to SetGenHeader instead.
What's Changed
- #81: Fix error handling in body writer by @wneessen in #82
- #80: GetAddrHeader and SetGenHeader by @wneessen in #83
Full Changelog: v0.3.4...v0.3.5