merge of '5616899c7c44519d7ea52d68cc931f9f056b9584'

and '6c9151f261ad9f73f6614808f73d4ca224c2cb8e'

Monotone-Parent: 5616899c7c44519d7ea52d68cc931f9f056b9584
Monotone-Parent: 6c9151f261ad9f73f6614808f73d4ca224c2cb8e
Monotone-Revision: 06d643c3c015e84728100fb5624bf4bac033748f

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-11-08T19:12:46
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2010-11-08 19:12:46 +00:00
17 changed files with 182 additions and 74 deletions
+15
View File
@@ -353,7 +353,22 @@ static NSString *sieveScriptName = @"sogo";
if (!sieveServer)
{
NSString *s;
sieveServer = @"localhost";
s = [dd imapServer];
if (s)
{
NSURL *url;
url = [NSURL URLWithString: s];
if ([url host])
sieveServer = [url host];
else
sieveServer = s;
}
}
else
{
+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