Commit graph

772 commits

Author SHA1 Message Date
05c2105705
Merge pull request #139 from wneessen/bugfix/138_segfault-in-writer-because-createpart-error-is-ignored
Fix nil pointer dereference in msgwriter due to missing error handling
2023-08-08 11:10:31 +02:00
edd6051df3
#138: Add error handling to message writing process
In the updated version of msgwriter.go, an additional error handling process has been included. If an error is detected when creating a new part in the message writer, this error is stored and prevents executing the writeBody function. This fixes nil pointer dereference in `mw.writeBody` if an error occured previously.
2023-08-08 10:59:10 +02:00
39080a8a05
#136: Add error handling to message writing process
In the updated version of msgwriter.go, an additional error handling process has been included. If an error is detected when creating a new part in the message writer, this error is stored and prevents executing the writeBody function. This fixes nil pointer dereference in `mw.writeBody` if an error occured previously
2023-08-08 10:54:38 +02:00
1c5c1e318c
#136: Refactor logging for clearer messaging direction
The logging system in the smtp.go and log package has been refactored. A new custom log type `Log` was introduced, that includes the message direction, format and arguments. The `Logger` interface and the `Stdlog` implementation were modified to accept this new type. This change provides a clearer understanding of message direction inside logs, allowing for easier debugging and reduced complexity. This change does not affect features or disrupt user functionality. Additionally, it allows for custom implementations of the log.Logger interface to without being forced to use the C --> S/C <-- S direction logging.
2023-08-02 11:43:45 +02:00
832c0026b1
Merge pull request #137 from wneessen/logger-readablity
Replace hardcoded '2' in Output with const CallDepth
2023-07-24 16:06:16 +02:00
7d69ec8faa
Replace hardcoded '2' in Output with const CallDepth
A `const CallDepth` placeholder has been introduced and has been set to 2. This is used as an argument in Output method calls in various log levels like debug, info, warn, and error in place of previously hardcoded '2'. This change improves the readability of the code. The '2' represented the call depth of log.Logger's Output method, which wasn't immediately clear with the hardcoded value.
2023-07-24 15:27:39 +02:00
2b27643187
Merge pull request #132 from drakkan/oauth2_test
oauth2: add more test cases
2023-06-04 16:01:42 +02:00
Nicola Murino
61b9e59dd2 oauth2: add more test cases 2023-06-04 10:47:19 +02:00
4100fef083
Merge pull request #131 from wneessen/v0.4.0-prep
Preparation for the v0.4.0 release:
2023-05-31 09:41:01 +02:00
c01788641b
Preparation for the v0.4.0 release:
- Updated discord link
2023-05-31 09:40:51 +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
30b20c5049
Merge pull request #130 from drakkan/xoauth2
add Oauth2 support
2023-05-31 09:24:26 +02:00
Nicola Murino
2122186ca3 CI FreeBSD: use the latest 12.x and 13.x versions 2023-05-29 18:22:58 +02:00
Nicola Murino
2a67b397c7 OAuth2: don't send the "*" command to cancel authentication
XOAUTH2 does not follow the SMTP AUTH RFC
2023-05-29 18:21:24 +02:00
Nicola Murino
8673addaf0 OAuth2: remove variants
Microsoft also accept the same protocol used for Google servers
2023-05-29 18:19:01 +02:00
Nicola Murino
6e4b348ccf add Oauth2 support
fixes #129
2023-05-28 14:31:04 +02:00
13c8d0a32c
Merge pull request #128 from sters/main
Adding WithDialContextFunc client option
2023-04-20 10:32:36 +02:00
sters
e757327e1d
Adding WithDialContextFunc client option 2023-04-19 23:20:33 +09:00
3a528f1d81
Merge pull request #127 from wneessen/126-sync-upstream-changes-to-netsmtp
Sync upstream changes to net/smtp
2023-04-12 10:04:46 +02:00
912797c782
#126: sync upstream changes to net/smtp
Related: https://github.com/golang/go/issues/58141
Resolves #126
2023-04-12 09:54:26 +02:00
89fd5dfa06
Merge pull request #122 from wneessen/121-using-defer-inside-for-loop-could-lead-to-leaks
Remove defer from for loops
2023-03-15 18:51:58 +01:00
13d0add21c
#121: Remove defer from for loops
Fixes #121. `defer` in for loops can possibly lead to leaks.

The whole handling including the defer are now moved into anonymous functions outside the for loop and are called form the loop instead. This way the defer is handle when the inline function finishes
2023-03-15 18:42:25 +01:00
cb9bec4a6f
Merge pull request #120 from wneessen/fix/119_golangci-lint-returns-errors
Make golangci-lint happy again
2023-03-11 11:08:16 +01:00
44dce70c46
#119 make golangci-lint happy again
Since we are Go <1.20 compatible, we can't easily combine errors here. The suggested golangci-lint fix will not work neither, since the %w verb can't be used twice. Therefore, for now we will ignore the linting error

Closes #119
2023-03-11 10:48:14 +01:00
84bc888344
Merge pull request #118 from cvette/main
fix: parsing of ReplyTo with special characters
2023-03-07 11:01:50 +01:00
Christian Vette
20fe4cd751
fix: parsing of ReplyTo with special characters 2023-03-07 10:51:15 +01:00
d052289575
Merge pull request #117 from wneessen/feature/107_provide-more-ways-for-middleware-to-interact-with-mail-parts
Provide more ways for middleware to interact with mail parts
2023-02-13 11:41:57 +01:00
2c3309fce7
More test coverage for the added functionalities 2023-02-13 11:27:25 +01:00
900280a6cd
Test coverage for the added functionalities 2023-02-13 11:09:19 +01:00
f7e1345f3d
Merge branch 'main' into feature/107_provide-more-ways-for-middleware-to-interact-with-mail-parts 2023-02-03 15:18:43 +01:00
a119616357
Merge pull request #115 from wneessen/112-evaluate-using-a-logger-interface-instead-of-golang-stdlib-log-package
Implement Logger interface
2023-02-03 10:50:50 +01:00
14be29818d
Add REUSE header 2023-02-03 10:21:27 +01:00
6633591b51
Implement Logger interface
As stated in https://github.com/wneessen/go-mail/pull/102#issuecomment-1411956040 it would be beneficial if, instead of forcing the Go stdlib logger on the user to provide a simple interface and use that for logging purposes.

This PR implements this simple log.Logger interface as well as a standard logger that satisfies this interface. If no custom logger is provided, the Stdlog will be used (which makes use of the Go stdlib again).

Accordingly, a `Client.WithLogger` and `Client.SetLogger` have been implemented. Same applies for the smtp counterparts.
2023-02-03 10:19:26 +01:00
0a3917f8fe
Merge pull request #114 from wneessen/update-golangci-lint
Update golangci-lint to Go 1.20
2023-02-02 19:22:52 +01:00
169286e109
Update golangci-lint to Go 1.20 2023-02-02 19:10:16 +01:00
5ceede61b6
Merge pull request #113 from wneessen/go1.20-workflow-update
Go1.20 workflow updates
2023-02-02 10:48:21 +01:00
0dca1491db
Looks like golangci-lint does not support 1.20 yet 2023-02-02 10:26:11 +01:00
fa0d51ec80
GH seems to interpret 1.20 as 1.2. Let's try if a string works 2023-02-02 10:23:51 +01:00
f3119cd098
Added version compatibility statement 2023-02-02 10:18:59 +01:00
c5481d9059
Updated workflows to Go 1.20 2023-02-02 10:16:46 +01:00
fa0b9709f6
Correct method names in caveat comment 2023-01-31 21:57:10 +01:00
fe28247f9b
The additional multipart start/stop are not needed here 2023-01-31 21:54:32 +01:00
d33f0e8004
Merge branch 'main' into feature/107_provide-more-ways-for-middleware-to-interact-with-mail-parts 2023-01-31 20:47:36 +01:00
6953977d03
Merge pull request #111 from wneessen/fix/110_attachment-issues
Fix Attach/EmbedReader and implement Attach/EmbedReadSeeker
2023-01-31 20:46:47 +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
dab860834a
Adding PGPType to Msg as preparation to support PGP/MIME in go-mail-middleware 2023-01-31 18:35:48 +01:00
c9794069cd
Add Caveat note about the io.Reader methods being memory inefficient 2023-01-31 17:48:19 +01:00
e66ad2be1a
Fix Attach/EmbedReader and implement Attach/EmbedReadSeeker
This PR addresses #110.
`Msg.AttachReader()` would not output the attached file after consecutive writes (e.g. a write to a file and then send via Client).

This PR fixes this behaviour by first reading the io.Reader into memory and then creating a new `bytes.Reader`, which does support seeking. In the writeFunc we then seek to position 0 after a successful `io.Copy`. This is probably not the most memory efficient way of handling this, but otherwise we'll have to break the `io.Reader` interface.

Additionally, a new way of attaching/embedding files has been added: `Msg.AttachReadSeeker()` and `Msg.EmbedReadSeeker()` which take a ´io.ReadSeeker` as argument instead. These two methods will skip the reading into memory and make use of the `Seek` method of the corresponding interface instead.
2023-01-31 17:38:31 +01:00
cfaeb51bef
Update README.md
Replaced discord channel
2023-01-29 14:52:43 +01:00
f2e0a9d63d
Merge pull request #109 from wneessen/feature/107_provide-more-ways-for-middleware-to-interact-with-mail-parts
Introduce GetEmbeds() and SetEmbeds()
2023-01-29 14:01:15 +01:00