Py-appscript:如何使用 Mail.app 发送消息
我正在尝试使用 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':'[email protected]'
})
但收到以下错误消息,并且我找不到任何相关信息...
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': '[email protected]', 'subject': 'appscript'})
请提出建议?
I'm trying to create mail with py-appscript (AppleScript interface for python).
I tried following code,
from appscript import *
mail = app('Mail')
msg = mail.make(new=k.outgoing_message,
with_properties={'visible':True,
'content':"hello",
'subject':"appscript",
'sender':'[email protected]'
})
but got following error messages, and I couldn't find out any information for that...
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': '[email protected]', 'subject': 'appscript'})
Suggestions, please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题自己解决了,下面的代码工作正常。
不再在构造函数中设置属性,单独设置每个属性。
Problem solved by myself, following code works fine.
Insted of setting properties in constructor, set each property separately.