Fix for bug #803

Monotone-Parent: c8d3bf05ef46d0c8d36879db7366c665f4dacd3d
Monotone-Revision: 303b1e781872f11eb1260c7f21d6ad5e73b55be7

Monotone-Author: ludovic@Sophos.ca
Monotone-Date: 2010-11-04T18:34:51
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Ludovic Marcotte
2010-11-04 18:34:51 +00:00
parent 1eb4cc93ce
commit dd099c9eca
2 changed files with 18 additions and 10 deletions
+6
View File
@@ -1,3 +1,9 @@
2010-11-04 Ludovic Marcotte <lmarcotte@inverse.ca>
SoObjects/SOGo/SOGoMailer.m
We stop when we see an invalid recipient and we inform the
client back with what are the invalid recipients
2010-11-04 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Tools/SOGoSockDOperation.m (_getFolderWithId:forUser:): invoke
+12 -10
View File
@@ -1,6 +1,6 @@
/* SOGoMailer.m - this file is part of SOGo
*
* Copyright (C) 2007-2009 Inverse inc.
* Copyright (C) 2007-2010 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
@@ -96,12 +96,9 @@
- (NSException *) _sendMailData: (NSData *) mailData
withClient: (NGSmtpClient *) client
andRejections: (unsigned int) toErrors
{
NSException *result;
if (toErrors > 0)
[self logWithFormat: @"sending email despite address rejections"];
if ([client sendData: mailData])
result = nil;
else
@@ -118,12 +115,13 @@
{
NGInternetSocketAddress *addr;
NSString *currentTo, *host;
NSMutableArray *toErrors;
NSEnumerator *addresses;
NGSmtpClient *client;
NSException *result;
NSRange r;
unsigned int toErrors, port;
unsigned int port;
client = [NGSmtpClient smtpClient];
host = smtpServer;
@@ -145,7 +143,7 @@
{
if ([client mailFrom: sender])
{
toErrors = 0;
toErrors = [NSMutableArray array];
addresses = [recipients objectEnumerator];
currentTo = [addresses nextObject];
while (currentTo)
@@ -153,17 +151,21 @@
if (![client recipientTo: [currentTo pureEMailAddress]])
{
[self logWithFormat: @"error with recipient '%@'", currentTo];
toErrors++;
[toErrors addObject: [currentTo pureEMailAddress]];
}
currentTo = [addresses nextObject];
}
if (toErrors == [recipients count])
if ([toErrors count] == [recipients count])
result = [NSException exceptionWithHTTPStatus: 500
reason: @"cannot send message:"
@" (smtp) all recipients discarded"];
else if ([toErrors count] > 0)
result = [NSException exceptionWithHTTPStatus: 500
reason: [NSString stringWithFormat:
@"cannot send message (smtp) - recipients discarded:\n%@",
[toErrors componentsJoinedByString: @", "]]];
else
result = [self _sendMailData: mailData withClient: client
andRejections: toErrors];
result = [self _sendMailData: mailData withClient: client];
}
else
result = [NSException exceptionWithHTTPStatus: 500