Open Source Cocoa/Cocoa-Touch POP3/SMTP library?
Asked Answered
D

3

25

I'm looking to write a sample application speaking to a POP3/SMTP server. Instead of re-inventing the wheel with BSD sockets and CFNetwork type calls, I'm curious if there is currently any open source libraries that already take care of alot of the dirty work? I've tried Googling without much luck for anything.

Perhaps there's something I'm overlooking to simplify this.

Thanks.

Dede answered 11/4, 2009 at 22:54 Comment(0)
C
31

MessageFramework on CocoaDev lists various possibilities,

"Sending emails from Cocoa" also lists several frameworks, including Pantomime, MailCore and EdMessage (the site for this seems to be down, but there is a mirror on github, which has also been modified to compile for 10.4, as well as 10.5 - so should work on the iPhone)

Example code using Pantomime (from the above blog-post):

CWMessage *message = [[CWMessage alloc] init];

CWInternetAddress *address;

address = [[CWInternetAddress alloc] initWithString:@"[email protected]"];
[message setFrom:address];
[address release];

address = [[CWInternetAddress alloc] initWithString:@"[email protected]"];
[address setType:PantomimeToRecipient];
[message addRecipient:address];
[address release];

[message setSubject:@"test"];

[message setContentType: @"text/plain"];
[message setContentTransferEncoding: PantomimeEncodingNone];
[message setCharset: @"us-ascii"];

[message setContent: [@"This is a simple content." dataUsingEncoding: NSASCIIStringEncoding]];

smtp = [[CWSMTP alloc] initWithName:@"smtp.gmail.com" port:465];
[smtp setDelegate: self];
[smtp setMessage: message];
[message release];

ssl = YES;
mechanism = @"PLAIN";

[smtp connectInBackgroundAndNotify];
Cerebrovascular answered 6/5, 2009 at 22:2 Comment(0)
O
6

Here is one. I have not tried it myself, but you can give it a shot...

http://code.google.com/p/skpsmtpmessage/

Optometrist answered 11/4, 2009 at 23:11 Comment(0)
S
1

You could also take a look at OmniGroup's open source frameworks, in particular the OmniNetworking framework. There are also a lot of other awesome components in their other frameworks you might consider using.

Sugared answered 10/5, 2009 at 21:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.