Skip to content

tessro/go-mail

Repository files navigation

go-mail

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! :)

Build Status

xkcd 1349: Shouldn’t Be Hard

go-mail is a robust RFC5322/2822/822 message parser.

Motivation

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.

Installation

go get github.com/paulrosania/go-mail

Documentation

Full API documentation is available here:

https://godoc.org/github.com/paulrosania/go-mail

Contributing

  1. Fork the project
  2. Make your changes
  3. Run tests (go test)
  4. Send a pull request!

If you’re making a big change, please open an issue first, so we can discuss.

Thanks

  • 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.)

License

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.

About

A robust RFC5322/2822/822 message parser

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published