Skip to content

Commit

Permalink
fix(mail): encode text MIME parts in quoted-printable
Browse files Browse the repository at this point in the history
This will limit each line to a maximum of 70 characters.

Fixes #5376
  • Loading branch information
cgx committed Aug 23, 2021
1 parent 145f221 commit 6cf3d99
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions SoObjects/Mailer/SOGoDraftObject.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#import <NGObjWeb/WOContext+SoObjects.h>
#import <NGObjWeb/WORequest+So.h>
#import <NGExtensions/NGBase64Coding.h>
#import <NGExtensions/NGQuotedPrintableCoding.h>
#import <NGExtensions/NSFileManager+Extensions.h>
#import <NGExtensions/NGHashMap.h>
#import <NGExtensions/NSNull+misc.h>
Expand Down Expand Up @@ -1270,11 +1271,12 @@ - (NGMimeBodyPart *) plainTextBodyPartForText
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;
Expand All @@ -1297,12 +1299,15 @@ This add the text typed by the user (the primary plain/text part).

// 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;
}
Expand Down

0 comments on commit 6cf3d99

Please sign in to comment.