Commit graph

38 commits

Author SHA1 Message Date
17b9d2ccf6
#80: GetAddrHeader and SetGenHeader
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
2022-11-19 11:22:20 +01:00
2e60d070a6
Add SetHeaderPreformatted() method
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
2022-10-26 15:33:03 +02:00
5bf0c10525
Randomness apparently not good enough for windows. Tests were failing. This fix improves it 2022-10-26 13:43:51 +02:00
021e003e78
Closes #74
This fix makes sure that generated message IDs via SetMessageID() are truly random and unique
2022-10-26 11:59:03 +02:00
2bd6851c78
Fix in the storage of the original Middleware 2022-10-25 16:56:40 +02:00
6f93e5835e
Introducing MiddlewareType and WriteToSkipMiddleware
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
2022-10-25 16:42:18 +02:00
b6beeb5cae
Finalized the Reader type and removed the broken Read() method 2022-10-20 18:26:51 +02:00
5faa6dfbd6
We now return a Reader instead of the io.Reader interface 2022-10-20 18:03:57 +02:00
Dhia Gharsallaoui
b94a42ebe8
Expose Msg attachments fields 2022-10-12 13:36:52 +02:00
da130c0222
Added test for Msg.GetGenHeader 2022-10-02 12:30:08 +02:00
dhia gharsallaoui
a4733f0618 Implement middleware concept and their test 2022-09-22 18:05:47 +02:00
46001dc691
Added support for requesting MDNs as described in RFC 8098 2022-09-09 11:35:45 +02:00
333c3970e7
#42: Add test for Msg.EnvelopeFromFormat 2022-09-08 15:08:03 +02:00
192627f6a5
Closes #29: Allow attaching/embedding from embed.FS
- 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
2022-07-07 10:46:57 +02:00
31001e87b2
#24: Add SPDX license IDs for REUSE compliance
# 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 :-)
2022-06-17 15:05:54 +02:00
e5abcb082d
#21: Fix ineffassign for GoLinter 2022-06-13 10:33:50 +02:00
d0292e863f
#21: Added tests for Msg.EnvelopeFrom and Msg.GetSender changes 2022-06-13 10:27:54 +02:00
85bbf744fa
#18: Method renaming and tests
- Renamed `Msg.WriteToTempfile` to `Msg.WriteToTempFile`
- Added test coverage for `Msg.WriteToFile` and `Msg.WriteToTempFile`
2022-06-09 10:11:37 +02:00
7050414529
Added test coverage for #13 2022-06-03 12:03:20 +02:00
dd02ac229b
Closes #11
This PR adds a `Msg.Read()` method which satisfies the `io.Reader` interface
2022-05-28 10:58:19 +02:00
ebef1fe476
Fixes #8
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.
2022-05-27 12:47:33 +02:00
894ff7128c
Rename Write() to WriteTo() so it satisfies the io.WriteTo interface 2022-05-24 15:46:59 +02:00
663954f370
Fix typos in msg_test.go 2022-03-20 18:30:29 +01:00
d6dffc3071
More test coverage 2022-03-19 20:50:05 +01:00
a47f372a1a
More tests for all types of parts 2022-03-19 18:33:04 +01:00
429c9a1883
More tests for msg.go 2022-03-19 16:56:38 +01:00
7b5b4fa52b
Windows has no sendmail, so let's exclude those tests for Windows 2022-03-18 23:10:53 +01:00
d653cdc782
GH tests failed due to /usr/bin/true... probably /bin/echo will behave better 2022-03-18 23:01:29 +01:00
0e00b165f9
WriteToSendmailWithContext tests revealed a race condition which has been fixed 2022-03-18 22:23:03 +01:00
709b4e6b91
Switched write functions to return the number of bytes. Due to failing tests in Msg.Write() 2022-03-18 17:08:05 +01:00
e909bd5499
More tests. 50% overall coverage now 2022-03-18 15:05:33 +01:00
c698312133
More tests for msg.go. 69% coverage - nice! 2022-03-18 14:36:44 +01:00
106e9c4f28
More tests for msg.go. Finally over 50% coverage there 2022-03-18 12:12:40 +01:00
f8a9512462
More tests for msg.go 2022-03-18 11:47:50 +01:00
96dab9103c
Make Linter happy 2022-03-13 17:58:47 +01:00
a85b761f43
msg.go has almost full test coverage now 2022-03-13 11:31:33 +01:00
012303e5ac
Lots of tests and helpers added 2022-03-13 10:49:07 +01:00
7266155cf4
Added AddTo() and FromFormat() 2022-03-12 20:05:43 +01:00