Skip to content

Commit c9805d7

Browse files
author
Sergei Epatov
committed
New errors detected and returned: ErrorSendMessageSpamSuspected, ErrorSendMessageDailyLimitExceeded
1 parent 35bf853 commit c9805d7

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

src/core/abstract/MCErrorMessage.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,14 @@ static const char * localizedDescriptionTable[] = {
4646
"An application specific password is required", /** MCOErrorGmailApplicationSpecificPasswordRequired */
4747
"An error when requesting date", /** MCOErrorServerDate */
4848
"No valid server found", /** MCOErrorNoValidServerFound */
49+
NULL, /** MCOErrorCustomCommand */
50+
"Cannot send message due to possible spam detected by server", /** MCOErrorSendMessageSpamSuspected */
51+
"User is over the limit for messages allowed to be sent in a single day", /** MCOErrorSendMessageDailyLimitExceeded */
4952
};
5053

5154
String * mailcore::errorMessageWithErrorCode(ErrorCode errorCode)
5255
{
53-
if (errorCode < 0) {
56+
if (errorCode < 0 || errorCode == ErrorCustomCommand) {
5457
return NULL;
5558
}
5659
if (errorCode >= sizeof(localizedDescriptionTable) / sizeof(localizedDescriptionTable[0])) {

src/core/smtp/MCSMTPSession.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,14 @@ void SMTPSession::sendMessage(Address * from, Array * recipients, Data * message
682682
goto err;
683683
}
684684
}
685+
else if (responseCode == 521 && response->locationOfString(MCSTR("limit")) != -1) {
686+
* pError = ErrorSendMessageDailyLimitExceeded;
687+
goto err;
688+
}
689+
else if (responseCode == 554 && response->locationOfString(MCSTR("spam")) != -1) {
690+
* pError = ErrorSendMessageSpamSuspected;
691+
goto err;
692+
}
685693

686694
* pError = ErrorSendMessage;
687695
MC_SAFE_REPLACE_COPY(String, mLastSMTPResponse, response);

src/objc/abstract/MCOConstants.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,10 @@ typedef NS_ENUM(NSInteger, MCOErrorCode) {
413413
MCOErrorNoValidServerFound,
414414
/** Error while running custom command */
415415
MCOErrorCustomCommand,
416+
/** Spam was suspected by server */
417+
MCOErrorSendMessageSpamSuspected,
418+
/** Daily limit of sent messages was hit */
419+
MCOErrorSendMessageDailyLimitExceeded,
416420
/** The count of all errors */
417421
MCOErrorCodeCount,
418422
};

0 commit comments

Comments
 (0)