jprobinson / eazye

The gangsta gangsta way to pull email

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Base64 Encoding in email.Text

tutley opened this issue · comments

While using this package in go 1.7, when grabbing emails that have "Content-Type-Encoding: base64", the email.Text is still encoded, it is not readable. (it isn't the text from the email, but the result of encoding)

I messed around with trying to grab the headers (email.Message.Header["Content-Type-Encoding"]) and oddly it doesn't seem to be consistently present. Sometimes it displays the value, other times it doesn't. If you print out the raw Message you see that the field is there every time.

Anyway I worked around this by simply decoding every email.Text and doing a simple check on the result to determine whether or not I should just use email.Text or the decoded value.

Howdy @tutley! Sorry for the delay.

I haven't run into an email with a Content-Type-Encoding header before. Could you possibly be meaning Content-Transfer-Encoding?

Do you happen to have an example? From there, I can toss it in a unit test and have a fix together pretty quickly.

Fixed with #11