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 26183 e63206c2ff6e675b8720002265103d1bfda5663e
parent 26182 5dc7de6025fd44ff418f22a8566864066946a733
child 26184 540dbf298f00c884387aa07048b715d57e7507ce
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
@@ -1037,17 +1037,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)
@@ -1364,17 +1364,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)
       {