feat: recreate message with parser's writer

This commit is contained in:
James Houlahan
2020-08-14 14:09:24 +02:00
parent 5343a6fc0f
commit 9821b5bbc2
6 changed files with 37 additions and 64 deletions

View File

@ -67,13 +67,7 @@ func (im *imapMailbox) CreateMessage(flags []string, date time.Time, body imap.L
// Called from go-imap in goroutines - we need to handle panics for each function.
defer im.panicHandler.HandlePanic()
buf := new(bytes.Buffer)
if _, err := buf.ReadFrom(body); err != nil {
return err
}
m, _, readers, err := message.Parse(buf.Bytes(), "", "")
m, _, _, readers, err := message.Parse(body, "", "")
if err != nil {
return err
}