我正在尝试用py-appscript回复Mail.app中的一封邮件。
我尝试了下面的代码,
from appscript import *
mailapp = app('Mail')
# get mail to be replied
msg = mailapp.accounts.first.mailboxes.first.messages.first
# create reply mail
reply_msg = mailapp.reply(msg)
# set mail (got error)
reply_msg.visible.set(True)
reply_msg.subject.set('replied message')
reply_msg.content.set('some content')但出现以下错误,设置主题失败。(设置可见属性成功)
CommandError: Command failed:
OSERROR: -10000
MESSAGE: Apple event handler failed.
COMMAND: app(u'/Applications/Mail.app').outgoing_messages.ID(465702416).subject.set('replied message')当我使用"make“而不是"reply”来创建新消息时,它会起作用。
# create new mail
msg = mailapp.make(new=k.outgoing_message)
# set mail (works fine)
msg.visible.set(True)
msg.subject.set('new mail')
msg.content.set('some content')你能告诉我这个错误是什么以及如何修复它吗?
发布于 2010-07-04 15:23:43
在10.6上运行良好,但在10.5 (以及更早的版本)上的邮件中有一个bug,导致由reply命令创建的传出消息不能正常工作。
如果你必须支持10.5,我认为你唯一的选择就是从头开始构建一条新的传出消息,从你回复给自己的消息中复制相关信息。
https://stackoverflow.com/questions/3173361
复制相似问题