mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-08-21 06:33:18 +00:00
Monotone-Parent: c0ec14b4c60cfc5b596b0425aed3a014bc69e18e
Monotone-Revision: 890780f417605e8803bbe725196d6f559c8a11c7 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-08-09T20:58:17 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -48,34 +48,33 @@
|
||||
|
||||
/* contents */
|
||||
|
||||
- (NSDictionary *)fetchInfo;
|
||||
- (NSException *)storeInfo:(NSDictionary *)_info;
|
||||
- (NSDictionary *) fetchInfo;
|
||||
- (NSException *) storeInfo: (NSDictionary *) _info;
|
||||
|
||||
/* attachments */
|
||||
|
||||
- (NSArray *)fetchAttachmentNames;
|
||||
- (BOOL)isValidAttachmentName:(NSString *)_name;
|
||||
- (NSException *) saveAttachment: (NSData *)_attach
|
||||
- (NSArray *) fetchAttachmentNames;
|
||||
- (BOOL) isValidAttachmentName: (NSString *) _name;
|
||||
- (NSException *) saveAttachment: (NSData *) _attach
|
||||
withMetadata: (NSDictionary *) metadata;
|
||||
- (NSException *)deleteAttachmentWithName:(NSString *)_name;
|
||||
- (NSException *) deleteAttachmentWithName: (NSString *) _name;
|
||||
|
||||
/* NGMime representations */
|
||||
|
||||
- (NGMimeMessage *)mimeMessage;
|
||||
- (NGMimeMessage *) mimeMessage;
|
||||
|
||||
- (NSString *)saveMimeMessageToTemporaryFile;
|
||||
- (NSString *)saveMimeMessageToTemporaryFileWithHeaders:(NSDictionary *)_addh;
|
||||
- (NSException *)sendMimeMessageAtPath:(NSString *)_path;
|
||||
- (NSString *) saveMimeMessageToTemporaryFile;
|
||||
- (NSString *) saveMimeMessageToTemporaryFileWithHeaders:(NSDictionary *)_addh;
|
||||
|
||||
- (NSException *)sendMail;
|
||||
- (NSException *) sendMail;
|
||||
|
||||
/* operations */
|
||||
|
||||
- (NSException *)delete;
|
||||
- (NSException *) delete;
|
||||
|
||||
/* fake being a SOGoMailObject */
|
||||
|
||||
- (id)fetchParts:(NSArray *)_parts;
|
||||
- (id) fetchParts: (NSArray *) _parts;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
#import <NGImap4/NGImap4EnvelopeAddress.h>
|
||||
#import <NGMail/NGMimeMessage.h>
|
||||
#import <NGMail/NGMimeMessageGenerator.h>
|
||||
#import <NGMail/NGSendMail.h>
|
||||
#import <NGMime/NGMimeBodyPart.h>
|
||||
#import <NGMime/NGMimeFileData.h>
|
||||
#import <NGMime/NGMimeMultipartBody.h>
|
||||
@@ -49,6 +48,7 @@
|
||||
#import <NGMime/NGMimeHeaderFieldGenerator.h>
|
||||
|
||||
#import <SoObjects/SOGo/NSCalendarDate+SOGo.h>
|
||||
#import <SoObjects/SOGo/SOGoMailer.h>
|
||||
|
||||
#import "SOGoDraftObject.h"
|
||||
|
||||
@@ -785,60 +785,8 @@ static BOOL showTextAttachmentsInline = NO;
|
||||
return ma;
|
||||
}
|
||||
|
||||
- (NSString *) _rawSender
|
||||
- (NSException *) sendMail
|
||||
{
|
||||
NSString *startEmail, *rawSender;
|
||||
NSRange delimiter;
|
||||
|
||||
startEmail = [self sender];
|
||||
delimiter = [startEmail rangeOfString: @"<"];
|
||||
if (delimiter.location == NSNotFound)
|
||||
rawSender = startEmail;
|
||||
else
|
||||
{
|
||||
rawSender = [startEmail substringFromIndex: NSMaxRange (delimiter)];
|
||||
delimiter = [rawSender rangeOfString: @">"];
|
||||
if (delimiter.location != NSNotFound)
|
||||
rawSender = [rawSender substringToIndex: delimiter.location];
|
||||
}
|
||||
|
||||
return rawSender;
|
||||
}
|
||||
|
||||
- (NSException *)sendMimeMessageAtPath:(NSString *)_path {
|
||||
static NGSendMail *mailer = nil;
|
||||
NSArray *recipients;
|
||||
NSString *from;
|
||||
|
||||
/* validate */
|
||||
|
||||
recipients = [self allRecipients];
|
||||
from = [self _rawSender];
|
||||
if ([recipients count] == 0) {
|
||||
return [NSException exceptionWithHTTPStatus:500 /* server error */
|
||||
reason:@"draft has no recipients set!"];
|
||||
}
|
||||
if ([from length] == 0) {
|
||||
return [NSException exceptionWithHTTPStatus:500 /* server error */
|
||||
reason:@"draft has no sender (from) set!"];
|
||||
}
|
||||
|
||||
/* setup mailer object */
|
||||
|
||||
if (mailer == nil)
|
||||
mailer = [[NGSendMail sharedSendMail] retain];
|
||||
if (![mailer isSendMailAvailable]) {
|
||||
[self errorWithFormat:@"missing sendmail binary!"];
|
||||
return [NSException exceptionWithHTTPStatus:500 /* server error */
|
||||
reason:@"did not find sendmail binary!"];
|
||||
}
|
||||
|
||||
/* send mail */
|
||||
|
||||
return [mailer sendMailAtPath:_path toRecipients:recipients sender:from];
|
||||
}
|
||||
|
||||
- (NSException *)sendMail {
|
||||
NSException *error;
|
||||
NSString *tmpPath;
|
||||
|
||||
@@ -851,8 +799,10 @@ static BOOL showTextAttachmentsInline = NO;
|
||||
}
|
||||
|
||||
/* send mail */
|
||||
error = [self sendMimeMessageAtPath:tmpPath];
|
||||
|
||||
error = [[SOGoMailer sharedMailer] sendMailAtPath: tmpPath
|
||||
toRecipients: [self allRecipients]
|
||||
sender: [self sender]];
|
||||
|
||||
/* delete temporary file */
|
||||
[self deleteTemporaryMessageFile:tmpPath];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user