Commit graph

74 commits

Author SHA1 Message Date
theexiile1305
9bdb741e05
feat: begin implementation of tests 2024-09-26 17:08:38 +02:00
theexiile1305
2368113872
feat: implementation of tests 2024-09-26 16:43:58 +02:00
theexiile1305
158c1b0458
moved S/MIME initialization into msg and the pointer to the data structure, also adjusted tests 2024-09-18 14:13:24 +02:00
theexiile1305
07d9654ce7
Attribute sMimeSinging was added in msg that indicates whether the message should be singed with S/MIME when it's sent. Also, sMimeAuthConfig was introduced in client so that required privateKey and certificate can be used for S/MIME signing. 2024-09-15 19:56:15 +02:00
Alexander Setzer
7caf0b8e19 Fix typo / inconsistency for (*Msg).SetAttachments 2024-08-14 14:55:08 +02:00
b88b67e2c7
Add GetBoundary method and corresponding test
The GetBoundary method has been added to the Msg struct in msg.go. Alongside this, a corresponding test method, TestMsg_GetBoundary, was introduced in msg_test.go to ensure the proper working of GetBoundary. This new method returns the boundary string of the Msg, which was previously inaccessible.
2024-07-02 10:58:13 +02:00
2e548512c6
Merge branch 'refs/heads/main' into feature/145_add-eml-parser-to-generate-msg-from-eml-files 2024-05-16 15:17:47 +02:00
dae7d80759
Add fuzzing tests for subject and from fields in msg_test.go
Included two new fuzzing tests for 'Subject' and 'From' to increase code coverage and reliability. These tests expand our checking strategy by using dynamic inputs and making sure no unexpected errors occur when dealing with a variety of possible input scenarios.
2024-03-23 16:46:21 +01:00
19a3cf61ed
Refactor variable names for code readability
Updated variable names in multiple files to enhance code readability and maintainability by replacing abbreviations with full descriptive names. This ensures adherence to the best practices of naming conventions in Go.
2024-02-27 11:21:28 +01:00
21d7b367bd
Update user agent test in msg_test.go
Updated the test "check default user agent" in `msg_test.go` to reflect dynamic versioning. The wantUserAgent field now uses fmt.Sprintf to combine the go-mail version dynamically, improving the accuracy of testing.
2024-02-26 21:05:52 +01:00
180f6f3a63
Add a new test for no default user agent in msg_test.go
A new test function named "TestNewMsgWithNoDefaultUserAgent" has been added in `msg_test.go` file. This function is meant to test 'NewMsg' function with 'WithNoDefaultUserAgent' parameter. The addition is devised to enhance the test coverage and ensure the noDefaultUserAgent field is functioning correctly.
2024-02-26 21:03:20 +01:00
grigorii
299490f8fa Add an option to skip adding a User-Agent (tests) 2024-02-26 10:30:33 -08:00
f759b1b5fb
Merge branch 'main' into feature/145_add-eml-parser-to-generate-msg-from-eml-files 2024-02-08 17:04:06 +01:00
a864be059c
Add "X-Auto-Response-Suppress" header and update SetBulk method
A new "X-Auto-Response-Suppress" header has been added. The SetBulk method has been updated to include this new header, as it is recommended for automated emails. This functionality is tested in the msg_test.go file.
2024-02-08 16:45:06 +01:00
8b19e497a0
Merge branch 'main' into feature/145_add-eml-parser-to-generate-msg-from-eml-files 2024-01-10 11:07:54 +01:00
rami
f445a55f7b Fixed msg_test.go 2023-12-25 12:17:55 +01:00
a12d9c327f
Merge branch 'main' into feature/145_add-eml-parser-to-generate-msg-from-eml-files 2023-12-07 13:21:30 +01:00
6268077b99
Make golangci-lint happy
Omitting nil redundant nil checks, as len() for []string is defined as zero
2023-11-30 09:14:31 +01:00
5dcbe712ae
Add null check to prevent empty file handle error in msg_test.go
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.
2023-11-29 17:47:30 +01:00
ddcad3710d
Fix potential null pointer exceptions in msg_test.go
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.
2023-11-29 17:46:30 +01:00
fb17547e69
Improve error handling in msg.go
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.
2023-11-29 17:40:31 +01:00
5a4f814061
Protect against key not found in genHeader map in msg.go
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.
2023-11-29 17:34:15 +01:00
fd313e23b6
Add checks for nil or empty Subject headers
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.
2023-11-29 17:26:47 +01:00
1e447b5f2c
Merge branch 'main' into feature/145_add-eml-parser-to-generate-msg-from-eml-files 2023-11-10 18:23:52 +01:00
43c26a37e3
Updated mail.Address initialization in tests to make golangci-lint happy
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.
2023-11-10 18:14:44 +01:00
cc14864129
#152: Add new methods and tests for handling email addresses
Added new methods `ToFromString()`, `CcFromString()` and `BccFromString()` in msg.go file to handle strings of comma-separated email addresses.
2023-11-10 18:07:56 +01:00
6bda5d1aaa
Merge branch 'main' into feature/145_add-eml-parser-to-generate-msg-from-eml-files 2023-10-20 14:23:24 +02:00
leahoop
3c2c106cb4 #147 add remove attachments and embeds methods 2023-10-20 10:21:03 +08:00
e7c717d0fc
"Rename Mime10 to MIME10 in codebase
Renamed field 'Mime10' to 'MIME10' across multiple files for canonical representation and consistency with standard MIME naming format in the protocol."
2023-10-13 15:23:28 +02:00
438cfd60eb
Preparation for the v0.4.0 release:
- 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
2023-05-31 09:34:45 +02:00
900280a6cd
Test coverage for the added functionalities 2023-02-13 11:09:19 +01:00
516b1f8ee2
Added test coverage for the specific bug in #110 and the newly added methods 2023-01-31 20:38:48 +01:00
25e00c64e2
Introduce GetEmbeds() and SetEmbeds()
These two methods work analogous to the `*Attachments()` methods and provide the user with access to the embedded files.
2023-01-29 13:48:51 +01:00
3922d3f195
Switched copyright header from me to "The go-mail Authors" 2023-01-15 16:14:19 +01:00
2a228c5b08
Merge pull request #83 from wneessen/feature/80_add-getaddrheader
#80: GetAddrHeader and SetGenHeader
2022-11-19 11:31:28 +01:00
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
47eb7b582b
#81: Fix error handling in body writer
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
2022-11-19 09:55:38 +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