From 916c04387b52d551a9496c19eb428e9271492653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20J=2E=20Hern=C3=A1ndez=20Blasco?= Date: Fri, 18 Dec 2015 12:23:49 +0100 Subject: [PATCH] oc-mail: Return error when delivery was not successful For example, if the SMTP is down, then the message is not sent and an error is returned. We returned back this error code to be managed by upper layer. --- OpenChange/MAPIStoreMailVolatileMessage.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenChange/MAPIStoreMailVolatileMessage.m b/OpenChange/MAPIStoreMailVolatileMessage.m index 90e459244..1db930ef8 100644 --- a/OpenChange/MAPIStoreMailVolatileMessage.m +++ b/OpenChange/MAPIStoreMailVolatileMessage.m @@ -1053,6 +1053,7 @@ MakeMessageBody (NSDictionary *mailProperties, NSDictionary *attachmentParts, NS - (int) submitWithFlags: (enum SubmitFlags) flags { + enum mapistore_error rc = MAPISTORE_SUCCESS; NSDictionary *recipients; NSData *messageData; NSMutableArray *recipientEmails; @@ -1099,7 +1100,10 @@ MakeMessageBody (NSDictionary *mailProperties, NSDictionary *attachmentParts, NS withAuthenticator: authenticator inContext: woContext]; if (error) - [self logWithFormat: @"an error occurred: '%@'", error]; + { + [self errorWithFormat: @"an error occurred: '%@'", error]; + rc = MAPISTORE_ERR_MSG_SEND; + } // mapping = [self mapping]; // [mapping unregisterURLWithID: [self objectId]]; @@ -1111,7 +1115,7 @@ MakeMessageBody (NSDictionary *mailProperties, NSDictionary *attachmentParts, NS [self logWithFormat: @"skipping submit of message with class '%@'", msgClass]; - return MAPISTORE_SUCCESS; + return rc; } - (void) save: (TALLOC_CTX *) memCtx