首页 > 解决方案 > 使用 Applescript 时为 Microsoft Outlook 选择邮箱

问题描述

我正在使用 Applescript 在 Microsoft Outlook 中自动起草和发送电子邮件。虽然一切都按预期从我自己的帐户发送电子邮件,但我想调整脚本以从我可以在 Outlook 中访问的其他帐户发送电子邮件。我找到了这篇文章,但是那里显示的方法对我来说会产生错误。

https://macscripter.net/viewtopic.php?pid=185222#p185222

如何调整下面的脚本以选择正确的邮箱来发送我的电子邮件?当我使用下面的脚本时,当我尝试保存它时会生成以下错误。

语法错误 预期的类名,但发现已识别

我已经用谷歌搜索了这条错误消息,但找不到与我更改发送电子邮件的帐户的任务相关的任何内容。

set theAccount to the first exchange account whose name is "second.account@company.com"
set recipientAddress to "first.last@company.com"
set theSubject to "This is only a test"
set theContent to "<html><body><p>This is only a test.</p></body></html>"

tell application "Microsoft Outlook"
    set newMessage to make new outgoing message with properties {account:theAccount, subject:theSubject, content:theContent}
    tell newMessage
        make new recipient at newMessage with properties {email address:{address:recipientAddress}}
    end tell
    save in drafts
end tell

标签: macosoutlookapplescript

解决方案


推荐阅读