+Without this patch mutt fails to send messages and ask for a password even if
+smtp_user and smtp_pass are defined in .muttrc, see upstream bug
+http://bugs.mutt.org/3289
+
+--- a/account.c
++++ b/account.c
+@@ -155,6 +155,8 @@
+ else if ((account->type == M_ACCT_TYPE_POP) && PopUser)
+ strfcpy (account->user, PopUser, sizeof (account->user));
+ #endif
++ else if (option (OPTNOCURSES))
++ return -1;
+ /* prompt (defaults to unix username), copy into account->user */
+ else
+ {
+@@ -215,6 +217,8 @@
+ else if ((account->type == M_ACCT_TYPE_SMTP) && SmtpPass)
+ strfcpy (account->pass, SmtpPass, sizeof (account->pass));
+ #endif
++ else if (option (OPTNOCURSES))
++ return -1;
+ else
+ {
+ snprintf (prompt, sizeof (prompt), _("Password for %s@%s: "),
+--- a/mutt_sasl.c
++++ b/mutt_sasl.c
+@@ -304,7 +304,7 @@
+
+ snprintf (prompt, sizeof (prompt), "%s: ", interaction->prompt);
+ resp[0] = '\0';
+- if (mutt_get_field (prompt, resp, sizeof (resp), 0))
++ if (option (OPTNOCURSES) || mutt_get_field (prompt, resp, sizeof (resp), 0))
+ return SASL_FAIL;
+
+ interaction->len = mutt_strlen (resp)+1;
+--- a/smtp.c
++++ b/smtp.c
+@@ -172,7 +172,7 @@
+ progress_t progress;
+ struct stat st;
+ int r, term = 0;
+- size_t buflen;
++ size_t buflen = 0;
+
+ fp = fopen (msgfile, "r");
+ if (!fp)
+@@ -454,12 +454,6 @@
+ }
+
+ #ifdef USE_SASL
+- if (!(conn->account.flags & M_ACCT_PASS) && option (OPTNOCURSES))
+- {
+- mutt_error (_("Interactive SMTP authentication not supported"));
+- mutt_sleep (1);
+- return -1;
+- }
+ return smtp_auth (conn);
+ #else
+ mutt_error (_("SMTP authentication requires SASL"));
+@@ -603,7 +597,7 @@
+ }
+ }
+ strfcpy (buf + len, "\r\n", sizeof (buf) - len);
+- } while (rc == smtp_ready);
++ } while (rc == smtp_ready && saslrc != SASL_FAIL);
+
+ if (smtp_success (rc))
+ {