我正在尝试使用py-appscript (python的AppleScript接口)创建邮件。我试着跟踪代码,
from appscript import *
mail = app('Mail')
msg = mail.make(new=k.outgoing_message,
with_properties={'visible':True,
'content':"hello",
'subject':"appscript",
'sender':'taichino@gmail.com'
})但得到了以下错误消息,而我找不到任何相关信息...
CommandError: Command failed:
OSERROR: -1701
MESSAGE: Some parameter is missing for command.
COMMAND: app(u'/Applications/Mail.app').make('outgoing_message', with_properties={'content': 'hello', 'visible': True, 'sender': 'taichino@gmail.com', 'subject': 'appscript'})有什么建议吗?
发布于 2010-07-02 23:39:49
我自己解决了这个问题,下面的代码运行良好。
from appscript import *
mail = app('Mail')
msg = mail.make(new=k.outgoing_message)
msg.subject.set("hello"),
msg.content.set("appscript")
msg.to_recipients.end.make(
new=k.to_recipient,
with_properties={k.address: 'taichino@gmail.com'}
)
msg.send()在构造函数中设置属性时,分别设置每个属性。
https://stackoverflow.com/questions/3166175
复制相似问题