通过可可应用程序发送电子邮件 [英] send email through a cocoa application

查看:85
本文介绍了通过可可应用程序发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法我可以发送电子邮件,像任何框架或东西。我试过一些(pantomime,mailcore),但我不能让他们工作。所以如果你知道任何框架/其他方法,或者如果你知道一个很好的开源示例使用pantomime或mailcore我会非常感激它

Is there any way I can send an email, like any frameworks or something. I've tried some (pantomime, mailcore) but I can't get them to work. So if you know of any frameworks/other methods, or if you know of a good open source example using either pantomime or mailcore I would greatly appreciate it

推荐答案

Growl的MailMe显示这样做。我们过去使用Message框架,但是它的公共API在64位的转换中消失了,所以我们不得不找到别的东西使它64位的干净。

Growl's MailMe display does this. We used to use the Message framework, but its public API went away in the 64-bit transition, so we had to find something else to make it 64-bit clean.

一段时间(在开始beta周期之前),我们使用脚本桥告诉Mail发送消息。这工作,根据补丁作者,但它是一个非常强的依赖于Mail,我确信我们的用户不使用Mail不喜欢。

For awhile (prior to starting the beta cycle), we were using Scripting Bridge to tell Mail to send the message. This worked, according to the patch author, but it's a very strong dependency on Mail, and I'm sure our users who don't use Mail wouldn't like it.

我看了Pantomime,EDMessage和SKPSMTPMessage。每一个对我们的需要太复杂(即,它是一个框架实现一个完整的邮件客户端),没有工作在Mac OS X或两者。

I looked at Pantomime, EDMessage, and SKPSMTPMessage. Every single one either was way too complex for our needs (i.e., it was a framework for implementing a complete mail client), didn't work on Mac OS X, or both.

我最后做的是编写一个Python脚本,使用Python的smtplib模块发送消息。 这里的脚本,根据BSD许可证。我们使用NSTask来运行python解释器并给它脚本,NSPipe给脚本提供密码和消息体。您可以使用--help选项从命令行运行脚本,以了解如何运行它。

What I ended up doing was writing a Python script to send the message using Python's smtplib module. Here's the script, under a BSD license. We use NSTask to run the python interpreter and give the script to it, and NSPipe to give the password and message body to the script. You can run the script from the command line with the --help option to see how to run it.

这篇关于通过可可应用程序发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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