Implemented a null check to ensure the 'fi' file handle is not empty. With the absence of this check, the test was continuing even when 'fi' was empty, leading to null pointer exceptions further down in the code.
Added robustness and improved error handling in msg_test.go by adding null checks before calling values from the genHeader map in RequestMDNTo and related functions. This enhancement was necessary to avoid the operations on non-existing keys and potential null pointer exceptions.
Added additional checks when calling values from the genHeader map in msg.go file. This is to prevent trying to operate on non-existing keys, hence avoiding possible null pointer exceptions. The checks ensure the key HeaderMessageID exists in the genHeader map before attempting to operate on it. This is essential for functions like RequestMDNTo, RequestMDNToFormat, and RequestMDNAddToFormat, thereby improving the robustness of the code.
Added checks to ensure the key HeaderMessageID exists in the genHeader map before attempting to operate on it in msg.go. This will prevent possible null pointer exceptions when trying to assign the key a value or append it to the mids slice.
Added condition checks in `msg_test.go` for nil or empty Subject headers in the assigned functions. If the Subject is found to be nil or its length is less than 1, an empty string is now appended to prevent issues arising from null pointers or non-existent Subject headers in email messages.
Tests for new mail address handling methods have been updated to use {Name:"", Address: "email@example.com"} format for initializing the []*mail.Address slices, instead of the previous shorthand {"", "email@example.com"}. This was done to increase code clarity and explicitness.
- Bump version in doc.go
- Add sonarlint to .gitignore
- Update README to reflect the changes and contributors
- Fixed typos in auth_cram_md5_118.go, msg.go, msg_test.go, reader.go and smtp_ehlo_117.go
This PR introduces two major changes:
* SetHeader and SetHeaderPreformatted have been deprecated in favour of SetGenHeader and SetGenHeaderPreformatted
As pointed out in #80 the naming was pretty confusing, given that we already have SetAddrHeader. With the new naming convention it should be more clear. For compatibility reasons the old methods have been kept for now but in reality they are just aliases to the new methods
* GetAddrHeader and GetAddrHeaderString have been introduced
As requested in #80 analogous to GetGenHeader we also need a similar method for the address headers. Since address headers are *mail.Address pointer, we've also added a *String method that will extract the address string and return a string slice instead
Additionally we're introducing methods for the actual address headers: GetTo, GetFrom, GetCc and GetBcc (with a *String counterpart as well). This way the user has full flexibility. Either they use the more "low-level" GetAddrHeader method or the higher level methods for the corresponding address type
The error handling in the msgWriter.writeBody() method was not working properly. We basically overwrote the mw.err with nil if the function that followed after a failed write attempt was successful again
This patch fixes#81
With the SetHeaderPreformatted() method we have the ability to set headers that are already preformatted by the user and will not be altered in the mail message output
For middlewares to be able to access the fully written mail message, we need a way to execute WriteTo without the calling middleware to be handled, otherwise we end up in an infinite loop
Therefore, this PR introduces the MiddlewareType and the corresponding change of the Middleware interface. We now require to return the MiddlewareType when the Type() method on the interface is called
This way we can also introduce the WriteToSkipMiddleware method which takes a MiddlewareType as argument. This will allow us to use a WriteTo call with the initiating Middleware to be skipped
- Added `EmbedFromEmbedFS()` to allow embedding from embed.FS
- Added `AttachFromEmbedFS()` to allow attaching from embed.FS
- Added `fileFromEmbedFS()` as internal method for both other m
methods to attach/embed the embed.FS file
# SUMMARY
* Bad licenses:
* Deprecated licenses:
* Licenses without file extension:
* Missing licenses:
* Unused licenses:
* Used licenses: CC0-1.0, MIT
* Read errors: 0
* Files with copyright information: 45 / 45
* Files with license information: 45 / 45
Congratulations! Your project is compliant with version 3.0 of the REUSE Specification :-)
We were using `io.Copy` to write to the body string/alternative string to the io.Writer. This placed the byte position of the buffer to be at the EOF after the first `WriteTo()` call leaving the output of a 2nd call to `WriteTo()` empty.