Commit graph

728 commits

Author SHA1 Message Date
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
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
3c0f5d03d8
Merge pull request #108 from wneessen/feature/107_provide-more-ways-for-middleware-to-interact-with-mail-parts
Introducing Msg part deletion
2023-01-28 14:49:08 +01:00
c602ba103f
Test for message part deletion
Added a test for the `Part.Delete` method
2023-01-28 14:42:29 +01:00
9724a2b523
Introducing Msg part deletion
This PR introduces a new struct field for the message parts: `del`

If the del flag is set to `true`, the msgWriter will ignore this part during the writing process.

Additionally, the `part` has now a `Delete` method that lets the user mark the part as deleted

This allows middleware to take further control of the Msg and is part of #107
2023-01-28 14:39:14 +01:00
91bfed3f3d
Merge pull request #104 from wneessen/refactor_dsn_to_smtp
Refactor DSN handling from client.go to smtp.go
2023-01-18 10:39:21 +01:00
63d8cef8ca
Refactor DSN handling from client.go to smtp.go
This PR refactors the the DSN (RFC 1891) SMTP client handling, that was introduced in f4cdc61dd0.

While most of the Client options stay the same, the whole workaround logic for the SMTP client has been removed and added as part of the SMTP client instead.

This was we got rid of the Client's own `mail()`, `rcpt()`, `dsnRcpt()`, `dsnMail()` methods as well as the copies of the `cmd()` and `validateLine()` methods. The Client is now using the proper `Mail()` and `Rcpt()` methods of the SMTP client instead.
2023-01-18 10:30:06 +01:00
f48c8326ca
Added GPG key to SECURITY.md 2023-01-15 22:40:28 +01:00
e4eb4d63ee
Merge pull request #103 from wneessen/update_docs_headers
Update documentation and copyright headers
2023-01-15 16:22:36 +01:00
3922d3f195
Switched copyright header from me to "The go-mail Authors" 2023-01-15 16:14:19 +01:00
f4b836143c
Updated Security reporting information 2023-01-15 16:13:10 +01:00
23a4261e60
Added note about forked smtp package
Additionally added new feature references and updated contributors section
2023-01-15 16:12:33 +01:00
4c3416d078
Bump version to 0.3.9 2023-01-15 16:11:15 +01:00
f3039cdce9
Merge pull request #102 from wneessen/101-client-debug-logging
Implement SMTP client debug logging
2023-01-14 13:18:45 +01:00
ccbab59207
Fix log direction string 2023-01-14 13:07:42 +01:00
e36511e90e
Fix tests to not log authentication data
We don't want to expose SMTP authentication details in tests, therefore the tests have been adjusted a bit
2023-01-14 13:05:04 +01:00
34b432a985
Implement debug logging in SMTP client
Resolves #101.

Since we now have full control over the SMTP client we can also access the message input and output.

This PR introduces a new debug logging feature. Via the `Client.WithDebugLog` the user can enable this feature. It will then make use of the new `smtp/Client.SetDebugLog` method. Once the flag is set to true, the SMTP client will start logging incoming and outgoing messages to os.Stderr.

Log directions will be output accordingly
2023-01-14 12:47:51 +01:00
813020f02d
Merge pull request #100 from wneessen/feature/97_fork-the-netsmtp-package-from-stdlib-into-go-mail
Fork the net/smtp package from Go's stdlib into go-mail
2023-01-13 17:51:16 +01:00
2950f222cf
Added backport comments as reference 2023-01-13 17:42:05 +01:00
8559e8c301
Re-introduce backwards compatibility with Go 1.17 and Go 1.18
The following changes make use of methods that are not available in Go 1.17/Go 1.18. To guarantee at least 4 versions of backwards compatibility, versioned copies of those changes have been back-ported:
- 4d8db00641 (diff-4f6f6bdb9891d4dd271f9f31430420a2e44018fe4ee539576faf458bebb3cee4)
- 58158e990f (diff-772fc9f5d0c86f26e35158fb3e7a71a4967d18b4ec23a5dbb60781ab0babf426)
2023-01-13 17:34:41 +01:00
7cb34856a3
Adjusting license headers and including original LICENSE file from the Go project into the smtp/ directory as suggested in https://github.com/wneessen/go-mail/issues/97#issuecomment-1381046444 2023-01-13 16:54:55 +01:00
f782f3f4fc
Merge branch 'main' into feature/97_fork-the-netsmtp-package-from-stdlib-into-go-mail 2023-01-12 01:31:36 +01:00
a7126b4201
Merge pull request #99 from wneessen/98-set-up-freebsd-tests-via-cirrus-ci
Set up FreeBSD tests via CirrusCI
2023-01-12 01:30:17 +01:00
09d7f1a4c4
#98 Set up FreeBSD tests via CirrusCI
Since we skip the sendmail test, we don't need postfix anymore
2023-01-12 01:22:45 +01:00
64dde76a58
#98 Set up FreeBSD tests via CirrusCI
Cirrus seems to kill the sendmail test, let's make it skip-able
2023-01-12 01:19:24 +01:00
433980a584
#98 Set up FreeBSD tests via CirrusCI
Apparently we can't provide the secrets environment to CirrusCI, so we cannot perform the send tests
2023-01-12 01:10:08 +01:00
d781217f07
#98 Set up FreeBSD tests via CirrusCI
Cirrus does not understand the double {{}}
2023-01-12 01:05:10 +01:00
2f053ed8ab
#98 Set up FreeBSD tests via CirrusCI
Need to debug the test-host for cirrus
2023-01-12 01:01:33 +01:00
4480a2bfa7
#98 Set up FreeBSD tests via CirrusCI
The .. didn't do anything but fail
2023-01-12 00:54:26 +01:00
4198664737
#98 Set up FreeBSD tests via CirrusCI
We need the environment also it starts in auth/ which is weird
2023-01-12 00:52:01 +01:00
570ccca98f
#98 Set up FreeBSD tests via CirrusCI
Since we already used CirrusCI in the beginning, we only need to modify the existing file.
2023-01-12 00:45:40 +01:00
820d1c25d8
Fork net/smpt into go-mail
Implemented negative check for AuthLogin Auth method
2023-01-11 20:35:22 +01:00
df7bb9b742
Fork net/smpt into go-mail
Fix open TODO in smtp_test.go and fork `testenv.SkipFlaky()` from `internal/testenv` to implement flaky test skipping for FBSD
2023-01-11 20:07:03 +01:00
8e807c2569
Fork net/smpt into go-mail
Fixed open issues in smtp_test.go
2023-01-11 15:28:33 +01:00
1836f6c49d
Start fixing golangci-lint findings in test suite 2023-01-10 16:55:47 +01:00
a804e4a101
Fix license SPDX headers for forked net/smtp code
- Also import the original BSD-3-Clause.txt license from the Go team into the LICENSES directory
- Further on, license headers should hold "The go-mail Authors" instead of my name. Did this already for the MIT license.
2023-01-10 10:09:45 +01:00
0d6777ab39
Fork net/smpt into go-mail
As part of #97 we are going to fork the official `net/smtp` package into go-mail to provide us with more flexibility.

This commit fulfills the first big step of importing the package into smtp/. Also go-mail's own LoginAuth has been moved from auth/ into smtp/ to be consistent with the stdlib.

There are still a couple of open issues (i. e. license adjustments and making golangci-lint happy) but so far all tests already work, which is a good start.
2023-01-10 00:38:42 +01:00
1e959a591d
Update doc.go
Bump version to 0.3.8
2023-01-07 11:58:11 +01:00
fb1d3197c8
Merge pull request #95 from wneessen/94-login-auth-next-handler-should-unconditionally-succeed-if-more-is-false
Fix SMTP AUTH LOGIN method for servers with uncommon success messages
2023-01-07 11:57:46 +01:00
39a9949e78
Fix auth_test.go accordingly
Removed "2.7.0 Authentication successful" challenge since this should never be sent with `more == true`.
2023-01-07 11:48:59 +01:00
862749f863
Fix SMTP AUTH LOGIN method for servers with uncommon success messages
This fixes #94 and basically reverts d0f0435. As James points out correctly in #94, we should not assume specific responses from the server. As long as the spec is followed and the server returns the correct SMTP code, we should not do our own magic.

I've also extended the `getTestConnection` method in client_test.go, so that we can specify more test environment options like `TEST_PORT` and `TEST_TLS_SKIP_VERIFY`. This was needed for testing with the ProtonMail Bridge which listens on a different port and has non-trusted certificates.
2023-01-07 11:31:46 +01:00
3b3c1e6e8d
Merge pull request #91 from wneessen/feature/90_provide-a-way-of-knowing-which-emails-failedsucceeded-in-sending
Introduction of new error type for sending errors
2023-01-03 11:22:32 +01:00
3d0939b597
Bump version to 0.3.7 for new release 2023-01-03 11:19:07 +01:00
5897bddd11
Update msg.go
Co-authored-by: iwittkau <iwittkau@users.noreply.github.com>
2023-01-02 22:29:10 +01:00
dbb596893d
Update msg.go
Co-authored-by: iwittkau <iwittkau@users.noreply.github.com>
2023-01-02 22:28:39 +01:00