MCOSMTPSession Class Reference
| Inherits from | NSObject |
| Declared in | MCOSMTPSession.h MCOSMTPSession.mm |
Overview
This class is used to create an SMTP connection and send messages
After calling a method that returns an operation you must call start: on the instance to begin the operation.
Tasks
Other Methods
-
hostnameproperty -
portproperty -
usernameproperty -
passwordproperty -
OAuth2Tokenproperty -
authTypeproperty -
connectionTypeproperty -
timeoutproperty -
checkCertificateEnabledproperty -
useHeloIPEnabledproperty -
connectionLoggerproperty -
dispatchQueueproperty -
operationQueueRunningproperty -
operationQueueRunningChangeBlockproperty -
– cancelAllOperations
Operations
Properties
OAuth2Token
This is the OAuth2 token.
@property (nonatomic, copy) NSString *OAuth2TokenDeclared In
MCOSMTPSession.hauthType
This is the authentication type to use to connect.
MCOAuthTypeSASLNone means that it uses the clear-text is used (and is the default).
@property (nonatomic, assign) MCOAuthType authTypeDiscussion
Warning: Important: Over an encrypted connection like TLS, the password will still be secure
Declared In
MCOSMTPSession.hcheckCertificateEnabled
When set to YES, the connection will fail if the certificate is incorrect.
@property (nonatomic, assign, getter=isCheckCertificateEnabled) BOOL checkCertificateEnabledDeclared In
MCOSMTPSession.hconnectionLogger
Sets logger callback. The network traffic will be sent to this block.
@property (nonatomic, copy) MCOConnectionLogger connectionLoggerDiscussion
[session setConnectionLogger:^(void * connectionID, MCOConnectionLogType type, NSData * data) { }];
Declared In
MCOSMTPSession.hconnectionType
This is the encryption type to use. See MCOConnectionType for more information.
@property (nonatomic, assign) MCOConnectionType connectionTypeDeclared In
MCOSMTPSession.hdispatchQueue
This property provides some hints to MCOSMTPSession about where it’s called from. It will make MCOSMTPSession safe. It will also set all the callbacks of operations to run on this given queue. Defaults to the main queue. This property should be used only if there’s performance issue using MCOSMTPSession in the main thread.
@property (nonatomic, retain) dispatch_queue_t dispatchQueueDeclared In
MCOSMTPSession.hhostname
This is the hostname of the SMTP server to connect to.
@property (nonatomic, copy) NSString *hostnameDeclared In
MCOSMTPSession.hoperationQueueRunning
The value will be YES when asynchronous operations are running, else it will return NO.
@property (nonatomic, assign, readonly, getter=isOperationQueueRunning) BOOL operationQueueRunningDeclared In
MCOSMTPSession.hoperationQueueRunningChangeBlock
Sets operation running callback. It will be called when operations start or stop running.
@property (nonatomic, copy) MCOOperationQueueRunningChangeBlock operationQueueRunningChangeBlockDiscussion
[session setOperationQueueRunningChangeBlock:^{ if ([session isOperationQueueRunning]) { } else { } }];
Declared In
MCOSMTPSession.hpassword
This is the password of the account.
@property (nonatomic, copy) NSString *passwordDeclared In
MCOSMTPSession.hport
This is the port of the SMTP server to connect to.
@property (nonatomic, assign) unsigned int portDeclared In
MCOSMTPSession.htimeout
This is the timeout of the connection.
@property (nonatomic, assign) NSTimeInterval timeoutDeclared In
MCOSMTPSession.huseHeloIPEnabled
If set to YES, when sending the EHLO or HELO command, use IP address instead of hostname. Default is NO.
@property (nonatomic, assign, getter=isUseHeloIPEnabled) BOOL useHeloIPEnabledDeclared In
MCOSMTPSession.hInstance Methods
checkAccountOperationWithFrom:
Returns an operation that will check whether the SMTP account is valid.
- (MCOSMTPOperation *)checkAccountOperationWithFrom:(MCOAddress *)fromDiscussion
MCOSMTPOperation * op = [session checkAccountOperationWithFrom:[MCOAddress addressWithMailbox:@"hoa@etpan.org"]];
[op start:^(NSError * error) {
}];
Declared In
MCOSMTPSession.hloginOperation
Returns an operation that will perform a login.
- (MCOSMTPOperation *)loginOperationDiscussion
MCOSMTPOperation * op = [session loginOperation]; [op start:^(NSError * error) { }];
Declared In
MCOSMTPSession.hnoopOperation
Returns an operation that will perform a No-Op.
- (MCOSMTPOperation *)noopOperationDiscussion
MCOSMTPOperation * op = [session noopOperation]; [op start:^(NSError * error) { }];
Declared In
MCOSMTPSession.hsendOperationWithData:
Returns an operation that will send the given message through SMTP. It will use the recipient set in the message data (To, Cc and Bcc). It will also filter out Bcc from the content of the message.
- (MCOSMTPSendOperation *)sendOperationWithData:(NSData *)messageDataDiscussion
Generate RFC 822 data using MCOMessageBuilder
MCOSMTPOperation * op = [session sendOperationWithData:rfc822Data];
[op start:^(NSError * error) {
}];
Declared In
MCOSMTPSession.hsendOperationWithData:from:recipients:
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.
- (MCOSMTPSendOperation *)sendOperationWithData:(NSData *)messageData from:(MCOAddress *)from recipients:(NSArray *)recipientsDiscussion
Generate RFC 822 data using MCOMessageBuilder
MCOSMTPOperation * op = [session sendOperationWithData:rfc822Data from:[MCOAddress addressWithMailbox:@“hoa@etpan.org”] recipients:[NSArray arrayWithObject:[MCOAddress addressWithMailbox:@“laura@etpan.org”]]]; [op start:^(NSError * error) { }];
Declared In
MCOSMTPSession.h