diff --git a/Source/CTSMTPConnection.m b/Source/CTSMTPConnection.m index e107fae..9bc7fe9 100644 --- a/Source/CTSMTPConnection.m +++ b/Source/CTSMTPConnection.m @@ -67,7 +67,7 @@ } } if (auth) { - [smtpObj authenticateWithUsername:username password:password server:server]; + success = [smtpObj authenticateWithUsername:username password:password server:server]; if (!success) { goto error; } @@ -129,7 +129,7 @@ error: } } if (auth) { - [smtpObj authenticateWithUsername:username password:password server:server]; + success = [smtpObj authenticateWithUsername:username password:password server:server]; if (!success) { goto error; } diff --git a/Source/MailCoreUtilities.m b/Source/MailCoreUtilities.m index c674413..626967a 100644 --- a/Source/MailCoreUtilities.m +++ b/Source/MailCoreUtilities.m @@ -67,10 +67,20 @@ NSError* MailCoreCreateError(int errcode, NSString *description) { } NSError* MailCoreCreateErrorFromSMTPCode(int errcode) { - const char *errStr = mailsmtp_strerror(errcode); NSString *description = @"Unknown error"; - if (errStr) { - description = [[NSString alloc] initWithCString:errStr encoding:NSUTF8StringEncoding]; + + switch (errcode) { + case MAILSMTP_ERROR_AUTH_LOGIN: + description = @"Invalid username or password"; + break; + + default: { + const char *errStr = mailsmtp_strerror(errcode); + if (errStr) { + description = [[NSString alloc] initWithCString:errStr encoding:NSUTF8StringEncoding]; + } + break; + } } return MailCoreCreateError(errcode, description); }