diff options
author | Sergei Epatov <sepatov@readdle.com> | 2015-08-07 14:48:08 +0300 |
---|---|---|
committer | Sergei Epatov <sepatov@readdle.com> | 2015-08-07 14:48:08 +0300 |
commit | 8ab1bb6d6bd7e439521d4e692375f04d52bb49a3 (patch) | |
tree | f9850ca7e6a42ea63fe3cdf9fc555f8066cacc3c /src | |
parent | 0d2d5e23fcf2026b337f65272837b43f761f45f9 (diff) |
MCSMTPSession: some MS-Exchange SMTP servers reply with permission problem undetectable by mailcore. Catch it and set specific error code instead of common one.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/smtp/MCSMTPSession.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/core/smtp/MCSMTPSession.cpp b/src/core/smtp/MCSMTPSession.cpp index 179c6c4e..375ef4b6 100644 --- a/src/core/smtp/MCSMTPSession.cpp +++ b/src/core/smtp/MCSMTPSession.cpp @@ -672,17 +672,22 @@ void SMTPSession::sendMessage(Address * from, Array * recipients, Data * message goto err; } else if (r != MAILSMTP_NO_ERROR) { - if ((responseCode == 550) && (response != NULL) && (response->hasPrefix(MCSTR("5.3.4")))) { - * pError = ErrorNeedsConnectToWebmail; - goto err; - } - else { - * pError = ErrorSendMessage; - MC_SAFE_REPLACE_COPY(String, mLastSMTPResponse, response); - mLastLibetpanError = r; - mLastSMTPResponseCode = responseCode; - goto err; + if ((responseCode == 550) && (response != NULL)) { + if (response->hasPrefix(MCSTR("5.3.4"))) { + * pError = ErrorNeedsConnectToWebmail; + goto err; + } + else if (response->hasPrefix(MCSTR("5.7.1 Client does not have permissions to send as this sender"))) { + * pError = ErrorSendMessageNotAllowed; + goto err; + } } + + * pError = ErrorSendMessage; + MC_SAFE_REPLACE_COPY(String, mLastSMTPResponse, response); + mLastLibetpanError = r; + mLastSMTPResponseCode = responseCode; + goto err; } bodyProgress(messageData->length(), messageData->length()); |