andrewferrier / email2pdf

Script to convert emails to PDF from the command-line, as well as detach recognized attachments. Helps to process incoming emails and assist automatically with a non-paper paperwork workflow. Designed to work in tandem with getmail to convert forwarded emails to PDF automatically.
MIT License
68 stars 35 forks source link

Wrap long lines in plain text mail bodies #120

Closed seifferth closed 4 years ago

seifferth commented 4 years ago

Afaik, lines in plain text emails should be wrapped at 80 characters. Unfortunately, not all of them are. Wrapping long lines in pre tags might cause them to be truncated at the page margin. This patch wraps each individual line in plain text body parts at 80 characters. Well formatted body parts will thus appear unchanged while badly formatted lines will be wrapped to comfortably fit the page.

Note: Depending on the output pdf's page size, lines with more than 80 characters may still fit the page. I still believe that 80 characters are a good choice, though, since they are the suggested line length for plain text emails.

andrewferrier commented 4 years ago

Again, another good call, and thanks for handling it line-by-line so the whole thing isn't re-wrapped, which could be too aggressive. Thanks for your contribution.