MailCore CTCoreAttachment example

To add attachments in MailCore add this ONLY after setBody/setHTMLBody:

// Set Attachments
NSString *filePrefix = [[NSBundle mainBundle] bundlePath];
NSString *path = [NSString stringWithFormat:@"%@/%@",filePrefix,@"TestData/DSC_6201.jpg"];
NSLog(@"path:%@", path);
CTCoreAttachment *attach = [[CTCoreAttachment alloc] initWithContentsOfFile:path];
if ([attach data]==nil) {
    NSLog(@"Error: attachment data is nil");
}
[myMessage addAttachment:attach];

Here, you should add TestData folder with image to your project as a folder reference.

Leave a Reply

Your email address will not be published. Required fields are marked *