diff --git a/ActiveSync/SOGoMailObject+ActiveSync.m b/ActiveSync/SOGoMailObject+ActiveSync.m index a1b8c8434..9950975d5 100644 --- a/ActiveSync/SOGoMailObject+ActiveSync.m +++ b/ActiveSync/SOGoMailObject+ActiveSync.m @@ -209,6 +209,7 @@ struct GlobalObjectId { // // - (NSData *) _preferredBodyDataInMultipartUsingType: (int) theType + nativeTypeFound: (int *) theNativeTypeFound { NSString *encoding, *key, *plainKey, *htmlKey, *type, *subtype; NSDictionary *textParts, *part; @@ -238,11 +239,22 @@ struct GlobalObjectId { } key = nil; + *theNativeTypeFound = 1; - if (theType == 2) - key = htmlKey; - else if (theType == 1) + if (theType == 2 && htmlKey) + { + key = htmlKey; + *theNativeTypeFound = 2; + } + else if (theType == 1 && plainKey) key = plainKey; + else if (theType == 2 && plainKey) + key = plainKey; + else if (theType == 1 && htmlKey) + { + key = htmlKey; + *theNativeTypeFound = 2; + } if (key) { @@ -263,6 +275,10 @@ struct GlobalObjectId { charset = @"us-ascii"; s = [NSString stringWithData: d usingEncodingNamed: charset]; + + if (theType == 1 && *theNativeTypeFound == 2) + s = [s htmlToText]; + d = [s dataUsingEncoding: NSUTF8StringEncoding]; } @@ -448,7 +464,7 @@ struct GlobalObjectId { } else if ([type isEqualToString: @"multipart"]) { - d = [self _preferredBodyDataInMultipartUsingType: theType]; + d = [self _preferredBodyDataInMultipartUsingType: theType nativeTypeFound: theNativeType]; } } else if (theType == 4) diff --git a/NEWS b/NEWS index d4399048e..c26b663b1 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,7 @@ Enhancements - added support for email categories using EAS (#2995) - now possible to always send vacation messages (#2332) - added EAS best practices to the documentation + - improved fetching of text parts over EAS Bug fixes - (regression) fixed sending a message when mail module is not active (#3088)