📧 Easy to use, yet comprehensive library for sending mails with Go https://go-mail.dev
Find a file
dependabot[bot] 7210d679db
Bump codecov/codecov-action from 4.6.0 to 5.0.1
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4.6.0 to 5.0.1.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](b9fd7d16f6...3b1354a6c4)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-15 14:02:43 +00:00
.github Bump codecov/codecov-action from 4.6.0 to 5.0.1 2024-11-15 14:02:43 +00:00
assets Switch logo to CC-BY-ND-4.0 license 2022-07-11 13:23:50 +02:00
LICENSES Change license to MIT 2024-11-11 20:16:09 +01:00
log code duplication reduction for jsonlog.go and stdlog.go 2024-10-11 13:56:11 +03:00
smtp Update SMTP test port variable and CI configuration 2024-11-14 10:45:35 +01:00
testdata Add test attachment and its license file 2024-10-28 22:08:35 +01:00
.gitignore Change license to MIT 2024-11-11 20:16:09 +01:00
.golangci.toml Enable gosec linter and add exclusion rules 2024-11-15 12:35:15 +01:00
auth.go Add fig.StringUnmarshaler support for LOGIN-NOENC and PLAIN-NOENC authentication methods 2024-10-22 16:09:12 +02:00
auth_test.go Add fig.StringUnmarshaler support for LOGIN-NOENC and PLAIN-NOENC authentication methods 2024-10-22 16:09:12 +02:00
b64linebreaker.go Refactor error handling in Base64LineBreaker 2024-10-23 11:16:09 +02:00
b64linebreaker_test.go Switch to using bytes.NewBuffer(nil) in tests 2024-10-23 17:57:09 +02:00
client.go Refactor error handling by renaming functions. 2024-11-13 22:47:53 +01:00
client_119.go Refactor SendError initialization for better readability 2024-11-14 10:20:52 +01:00
client_120.go Refactor SendError initialization for better readability 2024-11-14 10:20:52 +01:00
client_121_test.go Handle test server connection timeouts 2024-10-26 17:33:52 +02:00
client_test.go Allow configuration of test server port via environment variable 2024-11-14 10:36:24 +01:00
CODE_OF_CONDUCT.md Change license to MIT 2024-11-11 20:16:09 +01:00
codecov.yml Change license to MIT 2024-11-11 20:16:09 +01:00
CONTRIBUTING.md Change license to MIT 2024-11-11 20:16:09 +01:00
doc.go Update doc.go 2024-11-06 11:22:54 +01:00
doc_test.go Switched copyright header from me to "The go-mail Authors" 2023-01-15 16:14:19 +01:00
eml.go Refactor error handling in eml parser 2024-10-24 16:42:00 +02:00
eml_test.go fumpt'ed formatting 2024-10-25 11:36:05 +02:00
encoding.go Improve documentation for String methods 2024-10-06 13:53:20 +02:00
encoding_test.go Add support for US-ASCII (7bit) encoding 2024-08-01 10:54:42 +02:00
file.go Refactor documentation and enhance comments 2024-10-06 16:16:49 +02:00
file_test.go Refactor and reintegrate content type tests in file_test.go 2024-10-25 09:40:15 +02:00
go.mod Bump golang.org/x/crypto from 0.28.0 to 0.29.0 2024-11-08 13:31:55 +00:00
go.sum Bump golang.org/x/crypto from 0.28.0 to 0.29.0 2024-11-08 13:31:55 +00:00
go.sum.license Add license file for go.sum 2024-10-01 15:25:51 +02:00
header.go Refactor documentation for Importance methods 2024-10-06 16:19:53 +02:00
header_test.go Refactor header test structure and improve readability 2024-10-25 12:18:12 +02:00
LICENSE Switched copyright header from me to "The go-mail Authors" 2023-01-15 16:14:19 +01:00
msg.go Refactor buffer initialization in NewReader. 2024-10-28 17:04:44 +01:00
msg_test.go Fix typos: change "non-existant" to "non-existent" 2024-11-11 20:07:55 +01:00
msg_totmpfile.go Refine WriteToTempFile docstring 2024-10-06 16:21:37 +02:00
msg_totmpfile_116.go Refine WriteToTempFile docstring 2024-10-06 16:21:37 +02:00
msg_unix_test.go Add test coverage for WriteToTempFile method 2024-10-28 18:52:02 +01:00
msgwriter.go Refactor and document msgWriter methods 2024-10-06 16:42:50 +02:00
msgwriter_test.go Fix typo in Content-Disposition header in tests 2024-11-11 20:08:58 +01:00
part.go Add detailed comments and return descriptions to Part methods 2024-10-06 16:54:18 +02:00
part_test.go Refactor variable names for code readability 2024-02-27 11:21:28 +01:00
random.go Update character set and bit size for secure string generation 2024-10-07 15:03:07 +02:00
random_test.go Refactor and expand random string tests 2024-11-01 15:24:47 +01:00
reader.go Enhance and clarify Reader struct documentation 2024-10-06 17:05:04 +02:00
reader_test.go Refactor variable names for readability in reader.go 2024-02-26 00:56:29 +01:00
README.md Update README.md SMTP features and TLS support details 2024-11-11 20:23:42 +01:00
REUSE.toml Add REUSE.toml 2024-10-01 15:27:05 +02:00
SECURITY.md Change license to MIT 2024-11-11 20:16:09 +01:00
senderror.go Refactor error handling by renaming functions. 2024-11-13 22:47:53 +01:00
senderror_test.go Refactor error code functions and add enhanced status code tests 2024-11-13 22:53:18 +01:00
sonar-project.properties Change license to MIT 2024-11-11 20:16:09 +01:00
tls.go Refactor TLSPolicy documentation and String method 2024-10-06 17:15:39 +02:00
tls_test.go Switched copyright header from me to "The go-mail Authors" 2023-01-15 16:14:19 +01:00

go-mail - Easy to use, yet comprehensive library for sending mails with Go

GoDoc codecov Go Report Card Mentioned in Awesome Go #go-mail on Discord REUSE status OpenSSF Best Practices OpenSSF Scorecard buy ma a coffee

go-mail logo

The main idea of this library was to provide a simple interface for sending mails to my JS-Mailer project. It quickly evolved into a full-fledged mail library.

go-mail follows idiomatic Go style and best practice. It has a small dependency footprint by mainly relying on the Go Standard Library and the Go extended packages. It combines a lot of functionality from the standard library to give easy and convenient access to mail and SMTP related tasks.

In the early days, parts of this library (especially some parts of msgwriter.go) had been forked/ported from go-mail/mail and respectively go-gomail/gomail. Today most of the ported code has been refactored.

The smtp package of go-mail has been forked from the original Go stdlib's net/smtp package and has then been extended by the go-mail team to fit the packages needs (more SMTP Auth methods, logging, concurrency-safety, etc.).

Features

Here are some highlights of go-mail's featureset:

  • Very small dependency footprint (mainly Go Stdlib and Go extended packages)
  • Modern, idiomatic Go
  • Sane and secure defaults
  • Implicit SSL/TLS support
  • Explicit STARTTLS support with different policies
  • Makes use of contexts for a better control flow and timeout/cancelation handling
  • SMTP Auth support
    • CRAM-MD5
    • LOGIN
    • PLAIN
    • SCRAM-SHA-1/SCRAM-SHA-1-PLUS
    • SCRAM-SHA-256/SCRAM-SHA-256-PLUS
    • XOAUTH2
  • RFC5322 compliant mail address validation
  • Support for common mail header field generation (Message-ID, Date, Bulk-Precedence, Priority, etc.)
  • Concurrency-safe reusing the same SMTP connection to send multiple mails
  • Support for attachments and inline embeds (from file system, io.Reader or embed.FS)
  • Support for different encodings
  • Middleware support for 3rd-party libraries to alter mail messages
  • Support sending mails via a local sendmail command
  • Support for requestng MDNs (RFC 8098) and DSNs (RFC 1891)
  • DKIM signature support via go-mail-middlware
  • Message object satisfies io.WriterTo and io.Reader interfaces
  • Support for Go's html/template and text/template (as message body, alternative part or attachment/emebed)
  • Output to file support which allows storing mail messages as e. g. .eml files to disk to open them in a MUA
  • Debug logging of SMTP traffic
  • Custom error types for delivery errors
  • Custom dial-context functions for more control over the connection (proxing, DNS hooking, etc.)
  • Output a go-mail message as EML file and parse EML file into a go-mail message

go-mail works like a programatic email client and provides lots of methods and functionalities you would consider standard in a MUA.

Documentation

We aim for good GoDoc documenation in our library which gives you a full API reference. We also provide a more in-depth documentation website at go-mail.dev

Compatibility

Go is growing fast and providing great features with every new release. While we'd love to adopt the latest Go features into our code, we realize that not everybody using this package can run the latest Go versions. Therefore we try to implement alternative solutions for Go versions that do not support these features. Yet, the work needed to maintain the separate versions is not to be underestimated. For that reason, we might retire that code at some point. We guarantee that go-mail will always support the last four releases of Go. With two Go releases per year, this gives the user a timeframe of two years to update to the next or even the latest version of Go.

Support

We have a support and general discussion channel on Discord. Find us at: #go-mail alternatively find us on the Gophers Slack in #go-mail

Middleware

The goal of go-mail is to keep it free from 3rd party dependencies and only focus on things a mail library should fulfill. Yet, since version v0.2.8 we've added support for middleware on the Msg object, allowing 3rd parties to alter a given mail message to their needs without relying on go-mail to support their specific need.

To get our users started with message middleware, we've created a collection of useful middlewares. It can be found in a seperate repository: go-mail-middlware.

Merch

Thanks to our wonderful friends at HelloTux we can offer great go-mail merchandising. All merch articles are embroidery to provide the best and most long-lasting quality possible.

If you want to support the open source community and represent your favourite Go mail library with some cool drip, check out our merch shop at: https://www.hellotux.com/go-mail.

Examples

We provide example code in both our GoDocs as well as on our official Website (see Documentation). For a quick start into go-mail check out our Getting started guide.

Authors/Contributors

go-mail was initially created and developed by Winni Neessen, but over time a lot of amazing people contributed ot the project. Big thanks to all of them for improving the go-mail project (be it writing code, testing code, reviewing code, writing documenation or helping to translate the website):

A huge thank you also goes to Maria Letta for designing our super cool go-mail logo!

Sponsors

We sincerely thank our amazing sponsors for their generous support! Your contributions do not go unnoticed and helps keeping up the project!