jhillyerd / enmime

MIME mail encoding and decoding package for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get full bytes of rfc822 attachment

requaos opened this issue · comments

commented

What I did:

e, err := enmime.ReadEnvelope(email)
if err != nil {
	return err
}

for _, a := range e.Attachments {
	if a.ContentType == "message/rfc822" ||
		(strings.HasSuffix(strings.ToLower(a.FileName), ".eml") && a.ContentType == "application/octet-stream") {
		err := saveAttachment(a.Content)
		if err != nil {
			return err
		}
		return nil
	}
}

What I expected:
a.Content to be the full slice of bytes of the attachment

What I got:
just the body of the attached message without the headers, boundary...

Release or branch I am using:
origin/master

commented

Is there presently a way to preserve the original content of an attached rfc822 attachment?

This sounds like a bug, but it will be a while before I can get to it. If you have a simple/short email that reproduces the issue, attaching it here would be helpful.

commented

Just coming back to this now and it appears to either have been resolved or was never an issue.

Cool. Probably time for me to push out a new release, been a while.