commit | b49ceb6f6d49a21d04be6ff8867b2fdbd97a9817 | [log] [tgz] |
---|---|---|
author | Dusan Kasan <me@dusankasan.com> | Thu Apr 13 00:00:36 2017 +0200 |
committer | Dusan Kasan <me@dusankasan.com> | Thu Apr 13 00:00:36 2017 +0200 |
tree | 55e8c1c16dbb2704b65049cec2f853e06be3fcac | |
parent | 865598137b006ac18b6e8b9423777254acd2917e [diff] |
Refactored to closely follow RFC5322
This library allows for parsing an email message into a more convenient form than the net/mail
provides. Where the net/mail
just gives you a map of header fields and a io.Reader
of its body, Parsemail allows access to all the standard header fields set in RFC5322, html/text body as well as attachements/embedded as binary streams with metadata.
var reader io.Reader // this reads an email message email, err := parsemail.Parse(reader) // returns Email struct and error if err != nil { // handle error } fmt.Println(email.Subject) fmt.Println(email.From) fmt.Println(email.To) fmt.Println(email.HTMLBody)
It is missing some tests, and needs more work. Use at your own discretion.