aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objc/smtp
diff options
context:
space:
mode:
authorGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2013-08-17 20:09:36 -0700
committerGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2013-08-17 20:09:36 -0700
commitd510c2dda500ce3955df1c377410b1d8ffc9cf6b (patch)
tree48533e29001e31f4577dc1e312d075a1db7cd4f3 /src/objc/smtp
parent0bc9d79ada9b7a0a3f2cc2ea8c398e480be779f6 (diff)
Fixed #314: added -[MCOSMTPSession sendOperationWithData:from:recipients:]
Diffstat (limited to 'src/objc/smtp')
-rw-r--r--src/objc/smtp/MCOSMTPSession.h18
-rw-r--r--src/objc/smtp/MCOSMTPSession.mm13
2 files changed, 31 insertions, 0 deletions
diff --git a/src/objc/smtp/MCOSMTPSession.h b/src/objc/smtp/MCOSMTPSession.h
index bb7c5f57..6716ee30 100644
--- a/src/objc/smtp/MCOSMTPSession.h
+++ b/src/objc/smtp/MCOSMTPSession.h
@@ -93,6 +93,24 @@
- (MCOSMTPSendOperation *) sendOperationWithData:(NSData *)messageData;
/**
+ Returns an operation that will send the given message through SMTP.
+ It will use the sender and recipient set from the parameters.
+ It will also filter out Bcc from the content of the message.
+
+ Generate RFC 822 data using MCOMessageBuilder
+
+ MCOPOPOperation * op = [session sendOperationWithData:rfc822Data
+ from:[MCOAddress addressWithMailbox:@"hoa@etpan.org"]
+ recipients:[NSArray arrayWithObject:[MCOAddress addressWithMailbox:@"laura@etpan.org"]]];
+ [op start:^(NSError * error) {
+ ...
+ }];
+ */
+- (MCOSMTPSendOperation *) sendOperationWithData:(NSData *)messageData
+ from:(MCOAddress *)from
+ recipients:(NSArray *)recipients;
+
+/**
Returns an operation that will check whether the SMTP account is valid.
MCOPOPOperation * op = [session checkAccountOperationWithFrom:[MCOAddress addressWithMailbox:@"hoa@etpan.org"]];
diff --git a/src/objc/smtp/MCOSMTPSession.mm b/src/objc/smtp/MCOSMTPSession.mm
index c9f9f0fc..0c24f66c 100644
--- a/src/objc/smtp/MCOSMTPSession.mm
+++ b/src/objc/smtp/MCOSMTPSession.mm
@@ -109,6 +109,19 @@ MCO_OBJC_SYNTHESIZE_BOOL(setUseHeloIPEnabled, useHeloIPEnabled)
return result;
}
+- (MCOSMTPSendOperation *) sendOperationWithData:(NSData *)messageData
+ from:(MCOAddress *)from
+ recipients:(NSArray *)recipients
+{
+ mailcore::SMTPOperation * coreOp =
+ MCO_NATIVE_INSTANCE->sendMessageOperation(MCO_FROM_OBJC(Address, from),
+ MCO_FROM_OBJC(Array, recipients),
+ [messageData mco_mcData]);
+ MCOSMTPSendOperation * result = [[[MCOSMTPSendOperation alloc] initWithMCOperation:coreOp] autorelease];
+ [result setSession:self];
+ return result;
+}
+
- (MCOOperation *) checkAccountOperationWithFrom:(MCOAddress *)from
{
mailcore::SMTPOperation *coreOp = MCO_NATIVE_INSTANCE->checkAccountOperation(MCO_FROM_OBJC(mailcore::Address, from));