mblaze

Unix utilities to deal with Maildir - my mirror
git clone https://pi.duncano.de/git/mblaze.git
Log | Files | Refs | README | COPYING

commit 4a685de739e09810a49bbcb7138a8e86d26bae82
parent 958ad4e9f634d71f5659b179c909449a6915fc51
Author: Leah Neukirchen <leah@vuxu.org>
Date:   Sun,  9 Jul 2017 21:25:55 +0200

mmime: ensure 7bit or 8bit Content-Transfer-Encoding for message/rfc822 parts

RFC 2046, Section 5.2.1:
> No encoding other than "7bit", "8bit", or "binary" is permitted for
> the body of a "message/rfc822" entity.

(We'll generate 8bit when we have to and put the blame on the MTA.)

Diffstat:
mmime.c | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/mmime.c b/mmime.c @@ -219,11 +219,16 @@ gen_file(char *file, char *ct) bithigh++; } - if (strcmp(ct, "message/rfc822") == 0 && maxlinelen < 997) - maxlinelen = 0; - gen_attachment(filename, cd); + if (strcmp(ct, "message/rfc822") == 0) { + printf("Content-Type: %s\n", ct); + printf("Content-Transfer-Encoding: %dbit\n\n", + (bitlow > 0 || bithigh > 0) ? 8 : 7); + fwrite(content, 1, size, stdout); + return 0; + } + if (bitlow == 0 && bithigh == 0 && maxlinelen <= 78 && content[size-1] == '\n') { if (!ct)