-
Notifications
You must be signed in to change notification settings - Fork 100
Enmime Migration Guide
James Hillyerd edited this page May 20, 2018
·
5 revisions
Things you will likely need to update in your code:
import "github.com/jhillyerd/go.enmime"
becomes:
import "github.com/jhillyerd/enmime"
msg, err := mail.ReadMessage(reader)
var body *enmime.MIMEBody
body, err = enmime.ParseMIMEBody(msg)
becomes:
var env *enmime.Envelope
env, err = enmime.ReadEnvelope(reader)
var part *enmime.MIMEPart
part, err = enmime.ParseMIME(reader)
from := part.Header().Get("From")
becomes:
var part *enmime.Part
part, err = enmime.ReadParts(reader)
from := part.Header.Get("From")
Both versions of enmime would decode (base64 or quoted-printable) the content prior to making it available to clients. The new version also converts content to UTF-8 if it can determine the character set.
var content []byte
content = part.Content()
// or
writer.Write(part.Content())
becomes:
var content []byte
part = part.Content
// or
writer.Write(part.Content)