From 6cf3d9912595dccaf5e148b7ea622e933f5c0a76 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Mon, 23 Aug 2021 11:08:25 -0400 Subject: [PATCH] fix(mail): encode text MIME parts in quoted-printable This will limit each line to a maximum of 70 characters. Fixes #5376 --- SoObjects/Mailer/SOGoDraftObject.m | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/SoObjects/Mailer/SOGoDraftObject.m b/SoObjects/Mailer/SOGoDraftObject.m index 6c49c8fbc..e0c53849d 100644 --- a/SoObjects/Mailer/SOGoDraftObject.m +++ b/SoObjects/Mailer/SOGoDraftObject.m @@ -28,6 +28,7 @@ #import #import #import +#import #import #import #import @@ -1270,11 +1271,12 @@ static NSString *userAgent = nil; map = [[[NGMutableHashMap alloc] initWithCapacity: 1] autorelease]; [map setObject: contentTypeValue forKey: @"content-type"]; + [map setObject: @"quoted-printable" forKey: @"content-transfer-encoding"]; /* prepare body content */ bodyPart = [[[NGMimeBodyPart alloc] initWithHeader:map] autorelease]; - plainText = [text htmlToText]; + plainText = [[text htmlToText] stringByEncodingQuotedPrintable]; [bodyPart setBody: plainText]; return bodyPart; @@ -1297,12 +1299,15 @@ static NSString *userAgent = nil; // TODO: set charset in header! if (text) - [map setObject: (isHTML ? htmlContentTypeValue : contentTypeValue) - forKey: @"content-type"]; + { + [map setObject: (isHTML ? htmlContentTypeValue : contentTypeValue) + forKey: @"content-type"]; + [map setObject: @"quoted-printable" forKey: @"content-transfer-encoding"]; + } /* prepare body content */ bodyPart = [[[NGMimeBodyPart alloc] initWithHeader:map] autorelease]; - [bodyPart setBody: text]; + [bodyPart setBody: [text stringByEncodingQuotedPrintable]]; return bodyPart; }