的Automator / AppleScript的处理在Mac邮件传入电子邮件

问题描述:

我设计一个应用程序,允许用户通过电子邮件我崩溃报告,如果我的应用程序崩溃过。我想留在计算机上运行的Mac邮件,当邮件来自通过,一个剧本的Automator / AppleScript的运行来处理电子邮件的正文中的内容。

I'm designing an app that allows users to email me crash reports if my app ever crashes. I'd like to leave Mac Mail running on a computer and when an email comes through, an automator script / AppleScript runs to process the contents of the body of the email.

我有一个python脚本完成整个解析/处理,除非我必须将电子邮件的内容手动复制到一个文件,然后运行我的那个文件分析器。

I've got the entire parsing/processing done in a python script, except I have to manually copy the contents of the email into a file and then run my parser on that file.

什么是设置此所以最好的方式,我可以电子邮件的内容推入我的解析脚本?

What's the best way to set this up so I can the contents of the email be pushed into my parsing script?

非常感谢!

也许最简单的方法是定义一个Mail.app规则。您可以设置过滤条件,指定一组收到的电子邮件到规则应用到,你可以指定规则操作中是一个对传入邮件运行AppleScript。规则与Mail.app管理 preferences - > 规则。苹果提供与Mac OS X查看 /图书馆/脚本/邮件脚本/规则操作或搜索网页。

Probably the simplest approach is to define a Mail.app Rule. You can set up filtering conditions to specify the set of incoming email to apply the rule to and among the rule actions you can specify is one to run an AppleScript on incoming messages. Rules are managed with Mail.app Preferences -> Rules. Apple supplies examples of Rule Action scripts with Mac OS X. Look in /Library/Scripts/Mail Scripts/Rule Actions or search the web.