如何使用AppleScript打开新电子邮件,设置“收件人:”,“主题:”,并附加文件?

时间:2010-08-12 10:47:00

标签: applescript

为了帮助我的用户轻松报告问题,我想尽可能多地创建电子邮件。最重要的是,我想附加一个文件(日志文件)。

如何在AppleScript中执行此操作?

1 个答案:

答案 0 :(得分:2)

tell application "Mail"
    set theMessage to make new outgoing message with properties {visible:true, subject:"My Subject", content:"My Body"}
    tell theMessage
        make new to recipient at end of to recipients with properties {name:"Ben Waldie", address:"applescriptguru@mac.com"}
    end tell
    tell content of theMessage
        make new attachment with properties {file name:pathToFile} at after last paragraph
    end tell
end tell