From 71e3e15091958ad3be77435f71813931ea1b8285 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Wed, 10 Nov 2010 20:12:54 +0000 Subject: [PATCH] Monotone-Parent: 33b0351ec935bf11e615865737fa2434e2208e1b Monotone-Revision: 9618a3ef4b4d144965865ebb1d51bd446ca88dae Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2010-11-10T20:12:54 Monotone-Branch: ca.inverse.sogo --- SoObjects/SOGo/SOGoMailer.m | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/SoObjects/SOGo/SOGoMailer.m b/SoObjects/SOGo/SOGoMailer.m index 44cdffdb6..94430778d 100644 --- a/SoObjects/SOGo/SOGoMailer.m +++ b/SoObjects/SOGo/SOGoMailer.m @@ -139,8 +139,9 @@ addr = [NGInternetSocketAddress addressWithPort: port onHost: host]; - if ([client connectToAddress: addr]) + NS_DURING { + [client connectToAddress: addr]; if ([client mailFrom: sender]) { toErrors = [NSMutableArray array]; @@ -167,13 +168,17 @@ else result = [self _sendMailData: mailData withClient: client]; } - else - result = [NSException exceptionWithHTTPStatus: 500 - reason: @"cannot send message:" - @" (smtp) error when connecting"]; [client quit]; [client disconnect]; } + NS_HANDLER + { + NSLog(@"Could not connect to the SMTP server %@ on port %d", host, port); + result = [NSException exceptionWithHTTPStatus: 500 + reason: @"cannot send message:" + @" (smtp) error when connecting"]; + } + NS_ENDHANDLER; return result; }