Skip to content

Releases: wneessen/go-mail

v0.2.7: MDNs and DSNs

12 Sep 08:06
f4cdc61
Compare
Choose a tag to compare

This release adds support for requesting MDNs (RFC 8098) and DSNs (RFC 1891) to be delivered for outgoing mail messages. We've also added more test coverage.

MDNs

MDNs (Message Disposition Notification) allows you to request a - what is often referred to as - "read receipt". This is implemented via a message header and it's up the the recipients MUA to send out this notification to the sender.

Code example:

func main() {
	// [...]
	m := mail.NewMsg()
	if err := m.FromFormat("Max Tester", "[email protected]"); err != nil {
		panic(err)
	}
	if err := m.To("[email protected]"); err != nil {
		panic(err)
	}
	m.Subject("This is an example")
	if err := m.RequestMDNTo("[email protected]"); err != nil {
		fmt.Printf("failed to set MDN request header: %s", err)
	}
	// [...]
}

For MDNs we implement the same methods as for the To methods:

  • RequestMDNTo
  • RequestMDNToFormat
  • RequestMDNAddTo
  • RequestMDNAddToFormat

DSNs

DSNs (Delivery Status Notification) are an extension to the SMTP protocol and need to be supported by the sending server. The RFC for DSNs defines different parameters of which we've implemented the once which we think make most sense for go-mail:

  • The RET extension for the MAIL FROM command, to let the user specify if a DSN should contain the full mail (FULL) or only headers (HDRS) of the sent mail.
  • The NOTIFY extension that allows the user to request a DSN for the different types of allowed situations: NEVER, SUCCESS, FAILURE and DELAY

ENVID and ORCPT are currently not supported but might follow in a later relaese (please open an issue if you see usefulness in this).

Since DSNs are part of the SMTP protocol, these need to be enabled on the Client. We've added 3 ways to do so:

  • WithDSN: Which enables DSNs, sets the FULL Mail From Return Option and the SUCCESS and FAILURE Recipient Notify Options
  • WithDSNMailReturnType: which enables DSNs and allows the user to specify which type of Mail From Return Option is wanted
  • WithDSNRcptNotifyType: which enables DSNs and allows the user to specify which types of Recipient Notify Options are wanted

Code example:

func main() {
	// [...]
	cl, err := mail.NewClient("relay.example.net",
		mail.WithDSNMailReturnType(mail.DSNMailReturnFull),
		mail.WithDSNRcptNotifyType(mail.DSNRcptNotifyFailure, mail.DSNRcptNotifyDelay, mail.DSNRcptNotifySuccess))
	if err != nil {
		fmt.Printf("failed to create new client: %s\n", err)
		os.Exit(1)
	}
	// [...]
}

Noteworthy changes

  • 5bd3cec implements the MDN support
  • f4cdc61 implements the DSN support
  • da266bc adds better test coverage

v0.2.6: fix issue with Base64 encoded mail parts

14 Aug 10:20
c6fe75f
Compare
Choose a tag to compare

#37 brought up an issue, in which some mail servers would not accept mails sent via go-mail services. They returned 550 Maximum line length exceeded (see RFC 5322 2.1.1) errors. It turns out, that Go's encoding/base64 does not add line breaks when encoding data. This release adds a Base64LineBreaker struct, which satisfies the io.WriteCloser interface and makes sure that mail parts, that are base64 encoded, are properly broken up at 76 chars.

Noteworthy changes

  • c6fe75f introduces the Base64LineBreaker

Thanks to @chriselkins for bringing this to my attention!

v0.2.5: embed.FS support

07 Jul 09:02
3c426ed
Compare
Choose a tag to compare

This release adds support for embedding/attaching files directly from embed.FS. We've added two new methods:

  • Msg.EmbedFromEmbedFS() which will allow you to embed a file from a given embed.FS directly into the mail message
  • Msg.AttachFromEmbedFS() which will allow you to attach a file from a given embed.FS directly into the mail message

Noteworthy changes

  • #29 implements the embed.FS changes

v0.2.4: Dedicated envelope from address

13 Jun 08:50
d9491ee
Compare
Choose a tag to compare

This release adds support for setting a different envelope from address than the actual from address in the mail body. We've added two methods:

  • Msg.EnvelopeFrom() which will set the envelope from address analogous to the Msg.From() method
  • Msg.EnvelopeFromFormat() which will set a formated envelope from address analogous to the Msg.FromFormat() method

Msg.GetSender() which is used by the Client has been adjusted to return the envelope from in favour of the mail body from address. If no envelope from is set, it will still use the normal mail body from address as envelope from. The MsgWriter has been adjusted accordingly to only use the envelope from address if the mail body from address is not set.

Noteworthy changes

  • #21 implements the envelope from changes

v0.2.3: File output support

09 Jun 08:25
afa847d
Compare
Choose a tag to compare

This release adds support for writing mail messages directly into a file. We've added two methods:

  • Msg.WriteToTempFile() which will automatically generated a .eml file localted in the OS' temporary directory
  • Msg.WriteToFile() which takes a filename as argument and stores the output of the mail message into that file

If the message output is stored with a .eml file extension, the mail is usually detected as such and can be directly opened with the OS' MUA. This has been tested with Mail.App, Thunderbird and Outlook.

Noteworthy changes

  • #18 adds the support for the file output
  • bc9b39f switched the go.mod minimum version to 1.16, since we can fully support this

v0.2.2: Template support

03 Jun 11:39
d10dc92
Compare
Choose a tag to compare

This release adds support for html/template and text/template to go-mail. You are now able to utilize several methods to write the message body, add alternative body parts, add attachments or add embeds using Go's template engine.

Noteworthy changes

  • #13 adds template support
  • #14 started an effort to add more code examples to the documentation. This is an ongoing initiative,

v0.2.1: io.Reader interface

28 May 09:09
069ffa0
Compare
Choose a tag to compare

This release adds a Msg.Read() method to go-mail, so that it satisfies the io.Reader interface which allows us to e. g. use io.Copy to dump a message to a io.Writer

Changes

v0.2.0: Fixes in WriteTo() and WriteToSendmail()

27 May 11:02
c001ac5
Compare
Choose a tag to compare

This release fixes two bugs in the msg.WriteTo() and the msg.WriteToSendmail() methods

Changes

  • 4fe503d Fixes hanging reads in the msg.WriteToSendmail() method (see #7) Thanks to @inliquid for the PR
  • ebef1fe Fixes a bug in msg.WriteTo() that would not output the message body on subsequent calls to msg.WriteTo() after the first invocation of msg.WriteTo() (see #8). Thanks @inliquid for the bug report

v0.1.9: Satisfy io.WriteTo interface and fix in WriteToSendmail*

25 May 14:49
db9358f
Compare
Choose a tag to compare

Changes

  • 894ff71: Renamed msg.Write to msg.WriteTo to satisfy the io.WriteTo interface
  • 070eb39: Forcefully closing the STDIN pipe in the msg.WriteToSendmail* methods
  • fa7066c: Use /usr/sbin/sendmail as default location for the sendmail binary

v0.1.8: First release

21 Mar 14:13
22d679c
Compare
Choose a tag to compare

Changelog

  • 6a446bd fixes an issue in the SMTP AUTH module for "LOGIN" in case the server responds with an "Authentcation successful" response, which isn't really expected
  • 030eba8 Sets default headers if they are not set, also the generic headers are now sorted before writing

Since we finally reached a test coverage of 85%, this will be the first non pre-release.