开源 Cocoa/Cocoa-Touch POP3/SMTP 库? [英] Open Source Cocoa/Cocoa-Touch POP3/SMTP library?

查看:50
本文介绍了开源 Cocoa/Cocoa-Touch POP3/SMTP 库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望编写一个与 POP3/SMTP 服务器通信的示例应用程序.与其用 BSD 套接字和 CFNetwork 类型调用重新发明轮子,我很好奇目前是否有任何开源库已经处理了很多肮脏的工作?我尝试过谷歌搜索,但没有任何运气.

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.

谢谢.

推荐答案

CocoaDev 上的 MessageFramework 列出各种可能性,

"从 Cocoa 发送电子邮件" 还列出了几个框架,包括 哑剧MailCore和 EdMessage(网站 似乎已关闭,但有一个 github 上的镜像,它也被修改为编译为 10.4 和 10.5 - 所以应该在 iPhone 上工作)

"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:@"from@gmail.com"];
[message setFrom:address];
[address release];

address = [[CWInternetAddress alloc] initWithString:@"to@somewhere.com"];
[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];

这篇关于开源 Cocoa/Cocoa-Touch POP3/SMTP 库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆