Bug 1170002 Display name with comma in it does not get properly quoted in From field r=Ratty a=IanN for comm-beta comm-release (2.36) and comm-release (2.35) CLOSED TREE
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Sun, 07 Jun 2015 22:38:17 +0100
changeset 26088 e337a5714b5a42d83cd8045e1a4ad9856fda5830
parent 26087 fcd6e2b92e3d0d434ff990c7d6f713c9fb62e93b
child 26092 7937c522252e106d828ecb4a42e7c36914c13fd8
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersRatty, IanN
bugs1170002
Bug 1170002 Display name with comma in it does not get properly quoted in From field r=Ratty a=IanN for comm-beta comm-release (2.36) and comm-release (2.35) CLOSED TREE
suite/mailnews/compose/MsgComposeCommands.js
--- a/suite/mailnews/compose/MsgComposeCommands.js
+++ b/suite/mailnews/compose/MsgComposeCommands.js
@@ -946,17 +946,17 @@ function ComposeStartup(recycled, aParam
     if (identities.length == 0)
       identities = gAccountManager.allIdentities;
     params.identity = identities.queryElementAt(0, Components.interfaces.nsIMsgIdentity);
   }
 
   identityList.selectedItem =
     identityList.getElementsByAttribute("identitykey", params.identity.key)[0];
   if (params.composeFields.from)
-    identityList.value = params.composeFields.from;
+    identityList.value = MailServices.headerParser.parseDecodedHeader(params.composeFields.from)[0].toString();
   LoadIdentity(true);
   if (sMsgComposeService)
   {
     // Get the <editor> element to startup an editor
     var editorElement = GetCurrentEditorElement();
     gMsgCompose = sMsgComposeService.initCompose(params, window,
                                                  editorElement.docShell);
     if (gMsgCompose)
@@ -1273,17 +1273,19 @@ function DoSpellCheckBeforeSend()
 function GenericSendMessage( msgType )
 {
   if (gMsgCompose != null)
   {
     var msgCompFields = gMsgCompose.compFields;
     if (msgCompFields)
     {
       Recipients2CompFields(msgCompFields);
-      msgCompFields.from = GetMsgIdentityElement().value;
+      var address = GetMsgIdentityElement().value;
+      address = MailServices.headerParser.makeFromDisplayAddress(address);
+      msgCompFields.from = MailServices.headerParser.makeMimeHeader(address, 1);
       var subject = GetMsgSubjectElement().value;
       msgCompFields.subject = subject;
       Attachments2CompFields(msgCompFields);
 
       if (msgType == nsIMsgCompDeliverMode.Now ||
           msgType == nsIMsgCompDeliverMode.Later ||
           msgType == nsIMsgCompDeliverMode.Background)
       {