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).
Tag Archives: MailCore
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:
- Download MailCore from GitHub:
1234git clone https://github.com/mronge/MailCore.gitcd MailCore/git submodule initgit submodule update - Build m4, autoconf, automake, libtool on Mac OS X Lion using this post.
- 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
- 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:
1234567891011121314151617181920212223CTCoreMessage myMessage = [[CTCoreMessage alloc] init];// Set ToCTCoreAddress *addrTo1 = [CTCoreAddress address];[addrTo1 setEmail:@"Your E-mail1"];CTCoreAddress *addrTo2 = [CTCoreAddress address];[addrTo2 setEmail:@"E-mail2"];/*CTCoreAddress *addrTo3 = [CTCoreAddress address];[addrTo3 setEmail:@"E-mail3"];*/[myMessage setTo:[NSSet setWithObjects:addrTo1, addrTo2, nil]];// Set FromCTCoreAddress *addrFrom = [CTCoreAddress address];[addrFrom setEmail:@"Your E-mail"];[addrFrom setName:@"Your Name"];[myMessage setFrom:[NSSet setWithObject:addrFrom]];[myMessage setSubject:@"Test Mail Core"];[myMessage setHTMLBody:@"This is a test HTML message"];[CTSMTPConnection sendMessage:myMessage \server:@"smtp.mail.ru" username:@"YourUserName" \password:@"YourPassword" port:587 useTLS:YES useAuth:YES]; -
Use this method to retrieve message subjects from Inbox of your mail:
1234567891011121314151617- (IBAction)retrieveClicked:(id)sender {CTCoreAccount *account = [[CTCoreAccount alloc] init];[account connectToServer:@"imap.yandex.ru" port:143 \connectionType:CONNECTION_TYPE_PLAIN authType:IMAP_AUTH_TYPE_PLAIN \login:@"YOUR USERNAME" password:@"YOUR PASSWORD"];NSSet *subFolders = [account subscribedFolders];CTCoreFolder *inbox = [account folderWithPath:@"INBOX"];NSSet *messageList = [inbox messageObjectsFromIndex:1 \toIndex:0];for (CTCoreMessage *message in messageList) {NSLog(@"%@", [message subject]);}}