fixed issue in mail RawBody

This commit is contained in:
Paul 2019-12-30 23:30:17 +01:00
parent 0df0eec02a
commit a7da51d932

View File

@ -24,9 +24,7 @@ const contentTypeTextPlain = "text/plain"
func Parse(r io.Reader) (email Email, err error) {
var msgbody bytes.Buffer
msgbodycopy := io.TeeReader(r, &msgbody)
msgbodybytes, err := ioutil.ReadAll(msgbodycopy)
email.RawBody = string(msgbodybytes)
msg, err := mail.ReadMessage(&msgbody)
if err != nil {
@ -37,6 +35,7 @@ func Parse(r io.Reader) (email Email, err error) {
if err != nil {
return
}
email.RawBody = string(msgbodybytes)
contentType, params, err := parseContentType(msg.Header.Get("Content-Type"))
if err != nil {