From e2e53b5a53fb1aa2fd83ab0fa44eedfed9de970e Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Sat, 26 Dec 2009 16:01:08 +0000 Subject: [PATCH] See ChangeLog Monotone-Parent: 53a3680b094640a96987cce96326daad38a619e0 Monotone-Revision: 4b96a79ded99473f7c6766140d0cd061fbf033cf Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2009-12-26T16:01:08 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 9 +++++++++ SoObjects/SOGo/SOGoMailer.m | 27 +++++++++++++++++++++++---- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 42e07ba88..e386e4299 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-12-26 Ludovic Marcotte + + * SoObjects/SOGo/SOGoMailer.m (_smtpSendData: + toRecipients:sender:): We now honor the 'port' + part in the SMTP server address. So one can now + specify hostname:port (like localhost:587) as + a value of SOGoSMTPServer. This fixes + http://www.scalableogo.org/bugs/view.php?id=201 + 2009-12-25 Ludovic Marcotte * Tools/SOGoToolBackup.m (-fetchUserIDs:): diff --git a/SoObjects/SOGo/SOGoMailer.m b/SoObjects/SOGo/SOGoMailer.m index d9d40d2b9..13cd16398 100644 --- a/SoObjects/SOGo/SOGoMailer.m +++ b/SoObjects/SOGo/SOGoMailer.m @@ -30,6 +30,7 @@ #import #import #import +#import #import "NSString+Utilities.h" #import "SOGoDomainDefaults.h" @@ -115,14 +116,32 @@ toRecipients: (NSArray *) recipients sender: (NSString *) sender { + NGInternetSocketAddress *addr; + NSString *currentTo, *host; + NSEnumerator *addresses; NGSmtpClient *client; - NSEnumerator *addresses; - NSString *currentTo; - unsigned int toErrors; NSException *result; + NSRange r; + + unsigned int toErrors, port; client = [NGSmtpClient smtpClient]; - if ([client connectToHost: smtpServer]) + host = smtpServer; + port = 25; + + // We check if there is a port specified in the smtpServer ivar value + r = [smtpServer rangeOfString: @":"]; + + if (r.length) + { + port = [[smtpServer substringFromIndex: r.location+1] intValue]; + host = [smtpServer substringToIndex: r.location]; + } + + addr = [NGInternetSocketAddress addressWithPort: port + onHost: host]; + + if ([client connectToAddress: addr]) { if ([client mailFrom: sender]) {