Important note: go-mail is EXPERIMENTAL. It parses many messages correctly, but may return incorrect results or even crash with certain inputs. Many code paths lack test coverage. The API surface may change. You’ve been warned! :)
go-mail is a robust RFC5322/2822/822 message parser.
Email parsing is a pain. It spans many RFCs (e.g. 5322, 2045, 2046, 2047, 4289, 2049, 4288, 4021, 6532) and includes joys like:
- Comment-folding white space
- 7-bit encoding
- Content transfer encodings
- quoted printable
- base64
- Encoded words (
=?utf-8?q?email=20is=20hard?=
) - Multipart messages
… and that’s when things going smoothly. In practice, malformed messages are commonplace. go-mail accepts this reality and makes a best effort to interpret each message based on the sender’s intent.
go get github.com/paulrosania/go-mail
Full API documentation is available here:
https://godoc.org/github.com/paulrosania/go-mail
- Fork the project
- Make your changes
- Run tests (
go test
) - Send a pull request!
If you’re making a big change, please open an issue first, so we can discuss.
- Archiveopteryx, for providing a liberally-licensed, robust C++ parser. Much of the original go-mail implementation was derived from it.
- Roger Peppe, for the original go-charset library. (go-mail uses a fork.)
go-mail is provided under the MIT license. Major portions of the original implementation were derived from the excellent Archiveopteryx RFC2822 parser, which is provided under the PostgreSQL license. See the LICENSE file for details.