MCOMessageBuilder Class Reference
| Inherits from | MCOAbstractMessage : NSObject |
| Conforms to | NSCopying |
| Declared in | MCOMessageBuilder.h MCOMessageBuilder.mm |
Overview
This class will allow you to build a RFC 822 formatted message. For example when you need to send a message using SMTP, you need to generate first a RFC 822 formatted message. This class will help you do that.
MCOMessageBuilder * builder = [[MCOMessageBuilder alloc] init];
[[builder header] setFrom:[MCOAddress addressWithDisplayName:@"Hoa V. DINH" mailbox:@"hoa@etpan.org"];
NSArray * to = [NSArray arrayWithObject:[MCOAddress addressWithDisplayName:@"Gael Roualland" mailbox:@"gael@etpan.org"]];
[[builder header] setTo:to];
[[builder header] setSubject:@"A nice picture!"];
[builder setHTMLBody:@"<div>Here's the message I need to send.</div>"];
[builder addAttachment:[MCOAttachment attachmentWithContentsOfFile:@"/Users/foo/Pictures/image.jpg"]];
NSData * rfc822Data = [builder data];
Tasks
-
htmlBodyproperty -
textBodyproperty -
attachmentsproperty -
relatedAttachmentsproperty -
boundaryPrefixproperty -
– addAttachment: -
– addRelatedAttachment: -
– data -
– dataForEncryption -
– openPGPSignedMessageDataWithSignatureData: -
– openPGPEncryptedMessageDataWithEncryptedData: -
– htmlRenderingWithDelegate: -
– htmlBodyRendering -
– plainTextRendering -
– plainTextBodyRendering -
– plainTextBodyRenderingAndStripWhitespace:
Properties
attachments
List of file attachments.
@property (nonatomic, copy) NSArray *attachmentsDeclared In
MCOMessageBuilder.hboundaryPrefix
Prefix for the boundary identifier. Default value is nil.
@property (nonatomic, copy) NSString *boundaryPrefixDeclared In
MCOMessageBuilder.hhtmlBody
Main HTML content of the message.
@property (nonatomic, copy, setter=setHTMLBody:) NSString *htmlBodyDeclared In
MCOMessageBuilder.hrelatedAttachments
List of related file attachments (included as cid: link in the HTML part).
@property (nonatomic, copy) NSArray *relatedAttachmentsDeclared In
MCOMessageBuilder.hInstance Methods
addAttachment:
Add an attachment.
- (void)addAttachment:(MCOAttachment *)attachmentDeclared In
MCOMessageBuilder.haddRelatedAttachment:
Add a related attachment.
- (void)addRelatedAttachment:(MCOAttachment *)attachmentDeclared In
MCOMessageBuilder.hdataForEncryption
RFC 822 formatted message for encryption.
- (NSData *)dataForEncryptionDeclared In
MCOMessageBuilder.hhtmlBodyRendering
HTML rendering of the body of the message to be displayed in a web view.
- (NSString *)htmlBodyRenderingDeclared In
MCOMessageBuilder.hhtmlRenderingWithDelegate:
HTML rendering of the message to be displayed in a web view. The delegate can be nil.
- (NSString *)htmlRenderingWithDelegate:(id<MCOHTMLRendererDelegate>)delegateDeclared In
MCOMessageBuilder.hopenPGPEncryptedMessageDataWithEncryptedData:
Returns an OpenPGP encrypted message with a given encrypted data. The encrypted data needs to be computed before calling this method. You could use http://www.netpgp.com to generate it.
- (NSData *)openPGPEncryptedMessageDataWithEncryptedData:(NSData *)encryptedDataDeclared In
MCOMessageBuilder.hopenPGPSignedMessageDataWithSignatureData:
Returns an OpenPGP signed message with a given signature. The signature needs to be computed on the data returned by -dataForEncryption before calling this method. You could use http://www.netpgp.com to generate it.
- (NSData *)openPGPSignedMessageDataWithSignatureData:(NSData *)signatureDeclared In
MCOMessageBuilder.hplainTextBodyRendering
Text rendering of the body of the message. All end of line will be removed and white spaces cleaned up. This method can be used to generate the summary of the message.
- (NSString *)plainTextBodyRenderingDeclared In
MCOMessageBuilder.hplainTextBodyRenderingAndStripWhitespace:
Text rendering of the body of the message. All end of line will be removed and white spaces cleaned up if requested. This method can be used to generate the summary of the message.
- (NSString *)plainTextBodyRenderingAndStripWhitespace:(BOOL)stripWhitespaceDeclared In
MCOMessageBuilder.h