Bug 1140884 - "An error occurred while sending mail" error message (and other error messages?) garbled. r=mkmelin
authorSuyash Agarwal <syshagarwal@gmail.com>
Sun, 29 Mar 2015 11:46:00 +0200
changeset 22386 7be6b57175eb50a5fe1f90c1b32873a131692ca0
parent 22385 afe44dd0d4f8f65709440ae6d36ecf170e13edb9
child 22387 ce064c0d550b56f501ad16dd7d1109a04e8ea30d
push id1420
push usermbanner@mozilla.com
push dateMon, 29 Jun 2015 20:47:24 +0000
treeherdercomm-beta@b3db00bb24e8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs1140884
Bug 1140884 - "An error occurred while sending mail" error message (and other error messages?) garbled. r=mkmelin
mailnews/compose/src/nsSmtpProtocol.cpp
--- a/mailnews/compose/src/nsSmtpProtocol.cpp
+++ b/mailnews/compose/src/nsSmtpProtocol.cpp
@@ -1543,19 +1543,26 @@ nsresult nsSmtpProtocol::SendRecipientRe
     nsresult errorcode;
     if (TestFlag(SMTP_EHLO_SIZE_ENABLED))
       errorcode = (m_responseCode == 452) ? NS_ERROR_SMTP_TEMP_SIZE_EXCEEDED :
                   (m_responseCode == 552) ? NS_ERROR_SMTP_PERM_SIZE_EXCEEDED_2 :
                   NS_ERROR_SENDING_RCPT_COMMAND;
     else
       errorcode = NS_ERROR_SENDING_RCPT_COMMAND;
 
-    rv = nsExplainErrorDetails(m_runningURL, errorcode,
-                               m_responseText.get(),
-                               m_addresses[m_addressesLeft - 1].get());
+    if (errorcode == NS_ERROR_SENDING_RCPT_COMMAND) {
+      rv = nsExplainErrorDetails(
+        m_runningURL, errorcode, NS_ConvertUTF8toUTF16(m_responseText).get(),
+        NS_ConvertUTF8toUTF16(m_addresses[m_addressesLeft - 1]).get());
+    } else {
+      rv = nsExplainErrorDetails(m_runningURL, errorcode,
+                                 m_responseText.get(),
+                                 m_addresses[m_addressesLeft - 1].get());
+    }
+
     NS_ASSERTION(NS_SUCCEEDED(rv), "failed to explain SMTP error");
 
     m_urlErrorState = NS_ERROR_BUT_DONT_SHOW_ALERT;
     return(NS_ERROR_SENDING_RCPT_COMMAND);
   }
 
   if (--m_addressesLeft > 0)
   {