go-gomail / gomail

The best way to send emails in Go.
MIT License
4.33k stars 573 forks source link

Per-Part Content-Transfer-Encoding? #47

Closed daBrado closed 8 years ago

daBrado commented 8 years ago

I'd like to generate an email with a body and an attachment where each uses a different Content-Transfer-Encoding. Is this possible? It seems that each message part takes the value for the Content-Transfer-Encoding from the Message object's value for encoding, and are not independently settable.

Specifically, I want the body to have a Content-Type of "text/plain; format=flowed" with a Content-Transfer-Encoding of "8bit", and the attachment to have a Content-Type of "text/html" but with a Content-Transfer-Encoding of "quoted-printable". (I'd rather not have the format=flowed text be encoded as quoted-printable, since RFC 3676 says that it "should not" be so.)

I'm fine with manually encoding the data I give to SetBody and AddAlternative as 8bit and quoted-printable, respectively; I just need to be able set the Content-Transfer-Encoding on a per-part basis.

Is there a way to do that now? If not, does it seem like a reasonable thing to be able to do?

Thanks for any help.

alexcesaro commented 8 years ago

I am currently a bit busy but I'll have a look at this issue soon.

alexcesaro commented 8 years ago

That should be ok now using SetPartEncoding with SetBody or AddAlternative: https://godoc.org/github.com/go-gomail/gomail#example-SetPartEncoding

daBrado commented 8 years ago

Neat; thank you!