Tag Archives: MailCore

How to build Libetpan for iOS

1. Install Autoconf, Aclocal, Libtool using these instructions. Install XCode Command Line Tools (in Download section of Organizer)
2. Run this in Terminal.
libetpan/build-mac $sh update.sh
3. Try to open Libetpan project for Mac OS X and iOS, select target for iOS and build for Simulator.
4. If any *.a file is not found, build and copy it from iOSPorts for instance. (I had problems with libetpan/build-mac/libsasl-ios/lib/libsasl2.a: No such file or directory)
5. Go here in Finder
~/Library/Developer/Xcode/DerivedData/
6. Open something like
Libetpan/Build/Products/Debug
7. Copy this, it is your library for Intel 64bit based Simulator.
8. If this library works for you (for instance, in MailCore), create .a files for your device (another processor architecture).

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.

How to build MailCore framework on iOS

MailCore is a Cocoa e-mail framework built by Matt Ronge that is the core of the e-mail client Kiwi. MailCore provides a nice set of objects for working with IMAP, MIME and SMTP, all of which use the C e-mail library LibEtPan. Here is some short information about MailCore. This is short documentation on MailCore from Matt Ronge. Official website is here.

To make it run on your iOS simulator, do the following:

  1. Download MailCore from GitHub:
  2. Build m4, autoconf, automake, libtool on Mac OS X Lion using this post.
  3. Run update.sh script in MailCore to build and install everything before opening it in Xcode. If you don’t know, how to run shell scripts, read this
  4. Open MessageSender project in MailCore library. Select MessageSender to build. It will not do anything. To make it sending a test message write the following code in ViewDidLoad:
  5. Use this method to retrieve message subjects from Inbox of your mail:

Official MailCore website.