From 4a685de739e09810a49bbcb7138a8e86d26bae82 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Sun, 9 Jul 2017 21:25:55 +0200 Subject: 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.) --- mmime.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'mmime.c') diff --git a/mmime.c b/mmime.c index bc6e3bc..34749e5 100644 --- 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) -- cgit 1.4.1