The principle concept of this library was to offer a easy interface to ship emails for authors’ JS-Mailer tasks. It rapidly developed right into a full-fledged mail library.
go-mail follows the idiomatic Golang fashion and finest follow. Its solely dependency is the Go Commonplace Library. It combines many functionalities from the usual library to provide simple and handy entry to mail and SMTP-related duties.
Components of this library (particularly some elements of msgwriter.go) have been forked/ported from the go-mail/mail respectively go-gomail/gomail which each appear to not be maintained anymore.
Golang SMTP E-mail Library Options
A number of the options of this golang library:
- Solely Commonplace Library dependant
- Trendy, idiomatic Go
- Sane and safe defaults
- Implicit StartTLS help with totally different insurance policies
- Makes use of contexts for a greater management stream and timeout/cancelation dealing with
- SMTP Auth help (LOGIN, PLAIN, CRAM-MD)
- RFC5322 compliant mail deal with validation
- Specific SSL/TLS help
- Help for widespread mail header discipline technology (Message-ID, Date, Bulk-Priority, Precedence, and many others.)
- Reusing the identical SMTP connection to ship a number of mails
- Help for attachments and inline embeds (from file system,
io.Reader
orembed.FS
) - Help for various encodings
- Help sending mails by way of an area sendmail command
- Help for requestng MDNs (RFC 8098) and DSNs (RFC 1891)
- Message object satisfies
io.WriteTo
andio.Reader
interfaces - Help for Go’s
html/template
andtextual content/template
(as message physique, different half or attachment/emebed) - Output to file help which permits storing mail messages as e. g.
.eml
recordsdata to disk to open them in a MUA
go-mail works like a programmatic e mail consumer and offers numerous strategies and functionalities you’ll contemplate normal in an MUA.
Golang E-mail Library Examples
The package deal is shipped with GoDoc instance code for various eventualities. Test them out on its GoDoc web page
For ease of use, here’s a full utilization instance: