NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Go modules, #1317 by repository stars
Latest stable
v0.8.2
Last release 14 days ago
08 Nov 2026
Release timing varies
gaps range from 8 days to 5 months
Nearly every release is documented
notes for 48 of 48 stable releases
Nothing withdrawn
no release was ever pulled
5 years old
237 releases · first in 2022
Drag across the ruler to compare, or tap a release to open it.
This release adds a middleware concept to the Msg context to allow 3rd parties to extend mail messages with their own code. Thanks to Dhia Gharsallaou
This release adds a middleware concept to the Msg context to allow 3rd parties to extend mail messages with their own code. Thanks to Dhia Gharsallaoui for the PR!
It was also pointed out on Discord that it would be useful to have a DialAndSendWithContext() method, which is also part of this release.
DialAndSendWithContext() methodThis 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 co
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 (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", "max@example.net"); err != nil {
panic(err)
}
if err := m.To("toni@example.net"); err != nil {
panic(err)
}
m.Subject("This is an example")
if err := m.RequestMDNTo("max@example.net"); err != nil {
fmt.Printf("failed to set MDN request header: %s", err)
}
// [...]
}
For MDNs we implement the same methods as for the To methods:
RequestMDNToRequestMDNToFormatRequestMDNAddToRequestMDNAddToFormatDSNs (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:
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.NOTIFY extension that allows the user to request a DSN for the different types of allowed situations: NEVER, SUCCESS, FAILURE and DELAYENVID 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 OptionsWithDSNMailReturnType: which enables DSNs and allows the user to specify which type of Mail From Return Option is wantedWithDSNRcptNotifyType: which enables DSNs and allows the user to specify which types of Recipient Notify Options are wantedCode 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)
}
// [...]
}
Your coding agent can read these notes before it upgrades. Set up the MCP server →
c6fe75f2d3ad699edcd8a4f54038af213644b8f3 introduces the Base64LineBreaker
#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.
Base64LineBreakerThanks to @chriselkins for bringing this to my attention!
This release adds support for embedding/attaching files directly from embed.FS. We've added two new methods:
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 messageMsg.AttachFromEmbedFS() which will allow you to attach a file from a given embed.FS directly into the mail messageThis release adds support for setting a different envelope from address than the actual from address in the mail body. We've added two methods:
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() methodMsg.EnvelopeFromFormat() which will set a formated envelope from address analogous to the Msg.FromFormat() methodMsg.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.
This release adds support for writing mail messages directly into a file. We've added two methods:
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 directoryMsg.WriteToFile() which takes a filename as argument and stores the output of the mail message into that fileIf 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.
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 a
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.
Nothing published for this version
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
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
Msg.Read()This release fixes two bugs in the msg.WriteTo() and the msg.WriteToSendmail() methods
This release fixes two bugs in the msg.WriteTo() and the msg.WriteToSendmail() methods
msg.WriteToSendmail() method (see https://github.com/wneessen/go-mail/pull/7) Thanks to @inliquid for the PRmsg.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 report894ff7128c0088ecdd40037c56e3b8e21b1594b1: Renamed msg.Write to msg.WriteTo to satisfy the io.WriteTo interface
msg.Write to msg.WriteTo to satisfy the io.WriteTo interfacemsg.WriteToSendmail* methods/usr/sbin/sendmail as default location for the sendmail binaryNothing published for this version
Nothing published for this version
6a446bd4bd12fa0275f184ac84b397ffaa16dad5 fixes an issue in the SMTP AUTH module for "LOGIN" in case the server responds with an "Authentcation success
Since we finally reached a test coverage of 85%, this will be the first non pre-release.
d448f0566b85d7f93dbf0ee0149f4509bc745af1 fixes a bug in writeHeader(), that was producing double-spaces at line breaks for headers
b6d90eac6a089f12835c1459999c40d89c60e7db Removes the nil checking for the *Reader() methods, as it's unnessacary
0e00b165f92a7b41209f29f29020b750cb88eaff fixes a race condition in the WriteToSendmailWithContext() method
BREAKING CHANGE 709b4e6b916170ca18f22a43d9e52e61794b9ec2 adds an int64 return value to the various Writer functions. A test on the Msg.Write() method…
Msg.Write() method showed, that the returned number of bytes does not match the actul number of bytes returned. Reason for this was that the body writing methods were not counting the bytes, which I see as an incorrect behaviour. By returning the int64 value of written bytes the test will succeed againHeader and AddrHeaderOption functions that require input validationMsg.AttachFile() and Msg.EmbedFile(). If a file cannot be read it will be ignored and not added to the mail557a161a12f1f7b2b5e2e6e7056b4140455ea6f0 fixes a bug in the handling of address headers (encoding issues when special characters are used)
54da622bd1e25ee7a53165c87938bfd418943d3e adds support for sending a Msg using the local system sendmail binary => WriteToSendmail() and WriteToSendmai
11571803697a4d0c669e82a2b6e3a38f404b9e80 adds supports the attachment/inline-embedding of files (or data provided via io.Reader)
Also the README received some updates.
The lib is working in a way, that we can send mail and with body and multipart/alternative.
The lib is working in a way, that we can send mail and with body and multipart/alternative.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.