bug 534158 if smtp server doesn't advertise auth mechanisms, try to send mail directly, r=benb, sr=neil
authorDavid Bienvenu <bienvenu@nventure.com>
Fri, 25 Jun 2010 09:25:39 -0700
changeset 5898 a3b64b66c5fda94466fead0d6d96227e308cd60c
parent 5897 e4d9b646a966f1e17adc0fb279b35365ec96f39d
child 5899 a8b8bdb983aa0f8abd8540179ab6c262f73588cd
push idunknown
push userunknown
push dateunknown
reviewersbenb, neil
bugs534158
bug 534158 if smtp server doesn't advertise auth mechanisms, try to send mail directly, r=benb, sr=neil
mailnews/compose/src/nsSmtpProtocol.cpp
--- a/mailnews/compose/src/nsSmtpProtocol.cpp
+++ b/mailnews/compose/src/nsSmtpProtocol.cpp
@@ -996,30 +996,24 @@ PRInt32 nsSmtpProtocol::ProcessAuth()
             m_urlErrorState = NS_ERROR_STARTTLS_FAILED_EHLO_STARTTLS;
             return NS_ERROR_STARTTLS_FAILED_EHLO_STARTTLS;
         }
     }
   // (wrong indention until here)
 
   (void) ChooseAuthMethod(); // advance m_currentAuthMethod
 
-  if (m_prefAuthMethods == SMTP_AUTH_NONE_ENABLED) // No auth needed
+   // We don't need to auth, per pref, or the server doesn't advertise AUTH,
+  // so skip auth and try to send message.
+  if (m_prefAuthMethods == SMTP_AUTH_NONE_ENABLED || !TestFlag(SMTP_AUTH))
   {
     m_nextState = SMTP_SEND_HELO_RESPONSE;
     // fake to 250 because SendHeloResponse() tests for this
     m_responseCode = 250;
   }
-  // did the server advertise authentication capability at all,
-  // but we wanted to auth?
-  else if (!TestFlag(SMTP_AUTH))
-  {
-    m_urlErrorState = NS_ERROR_SMTP_AUTH_NOT_SUPPORTED;
-    m_nextState = SMTP_ERROR_DONE;
-    return NS_ERROR_SMTP_AUTH_FAILURE;
-  }
   else if (m_currentAuthMethod == SMTP_AUTH_EXTERNAL_ENABLED)
   {
     buffer = "AUTH EXTERNAL =";
     buffer += CRLF;
     SendData(url, buffer.get());
     m_nextState = SMTP_RESPONSE;
     m_nextStateAfterResponse = SMTP_AUTH_EXTERNAL_RESPONSE;
     SetFlag(SMTP_PAUSE_FOR_READ);