Bug 1536477 - When no body is supplied via MAPI, honour default compose format. r=aceman
authorJorg K <jorgk@jorgk.com>
Sun, 22 Sep 2019 22:30:51 +0200
changeset 36906 f3f61fcc001af6ca42bfe1b3ca45f8f22a768ce7
parent 36905 e6dd9b872738cce894ea344bd859b092d1a01384
child 36907 01e2ce757bf781c1389db16f30b6b6ba384fec08
push id395
push userclokep@gmail.com
push dateMon, 02 Dec 2019 19:38:57 +0000
reviewersaceman
bugs1536477
Bug 1536477 - When no body is supplied via MAPI, honour default compose format. r=aceman
mailnews/mapi/mapihook/src/msgMapiHook.cpp
--- a/mailnews/mapi/mapihook/src/msgMapiHook.cpp
+++ b/mailnews/mapi/mapihook/src/msgMapiHook.cpp
@@ -672,16 +672,20 @@ nsresult nsMapiHook::PopulateCompFieldsW
     if (NS_FAILED(rv)) return rv;
     if (Body.IsEmpty() || Body.Last() != '\n') Body.AppendLiteral(CRLF);
 
     // This is needed when Simple MAPI is used without a compose window.
     // See bug 1366196.
     if (Body.Find("<html>") == kNotFound) aCompFields->SetForcePlainText(true);
 
     rv = aCompFields->SetBody(Body);
+  } else {
+    // No body: Assume that we can do plaintext. This will trigger the default
+    // compose format in ShowComposerWindow().
+    aCompFields->SetForcePlainText(true);
   }
 
 #ifdef RAJIV_DEBUG
   // testing what all was set in CompFields
   printf("To : %S \n", To.get());
   printf("CC : %S \n", Cc.get());
   printf("BCC : %S \n", Bcc.get());
 #endif
@@ -754,16 +758,20 @@ nsresult nsMapiHook::PopulateCompFieldsW
     nsString Body(aMessage->lpszNoteText);
     if (Body.IsEmpty() || Body.Last() != '\n') Body.AppendLiteral(CRLF);
 
     // This is needed when Simple MAPI is used without a compose window.
     // See bug 1366196.
     if (Body.Find("<html>") == kNotFound) aCompFields->SetForcePlainText(true);
 
     rv = aCompFields->SetBody(Body);
+  } else {
+    // No body: Assume that we can do plaintext. This will trigger the default
+    // compose format in ShowComposerWindow().
+    aCompFields->SetForcePlainText(true);
   }
   return rv;
 }
 
 // this is used to populate the docs as attachments in the Comp fields for Send
 // Documents
 nsresult nsMapiHook::PopulateCompFieldsForSendDocs(
     nsIMsgCompFields *aCompFields, ULONG aFlags, LPSTR aDelimChar,