【发布时间】:2019-02-06 20:35:07
【问题描述】:
我正在尝试使用 Apple 脚本通过其 id 从 Mail.app 获取消息。如果消息仍在收件箱中,它可以工作,但是我在本地 Mac 上有消息,帐户名称为“在我的 Mac 上”,每当我运行此脚本时,它都会给我一个错误“邮件出错:无法获取帐户”在我的 Mac 上”。编号:-1728”。
# THIS WORKS
# set MessageID to 375586
# set _mailBox to "INBOX"
# set _account to "TheWilliamson"
# THIS DOESN'T WORK
set MessageID to 11351
set _mailBox to "2001"
set _account to "On My Mac"
tell application "Mail"
try
set mybox to mailbox _mailBox of account _account
# ERROR: Mail got an error: Can’t get account "On My Mac". Number: -1728
on error eStr number eNum
display dialog eStr & " Number: " & eNum buttons {"OK"} default button 1
return
end try
end tell
【问题讨论】: