ryanb / letter_opener

Preview mail in the browser instead of sending.
MIT License
3.73k stars 238 forks source link

Ensure that body encoding is observed correctly in QP CTE #88

Closed mkdynamic closed 10 years ago

mkdynamic commented 10 years ago

When you use Quoted Printable (QP) Content Transfer Encoding (CTE), reading the message body via .body.to_s does not observe the original encoding of the message body before Content Transfer Encoding.

The API for this in the mail gem is somewhat non obvious, but the correct way to read the message body is via calling .decoded directly on the part in question (see https://github.com/mikel/mail/issues/618, https://github.com/mikel/mail/issues/403, https://github.com/mikel/mail/issues/512 for further details).

There may well be other Content Transfer Encodings that have a similar issue. This should solve those cases too, but the test coverage is specific to QP, since adding a test all possible CTEs is overkill IMHO.

nashby commented 10 years ago

@mkdynamic nice, thanks!