AppleScript无法读取Mail.app的消息

时间:2012-09-13 05:35:07

标签: email applescript

我有一个脚本,以前完美地检查我是否收到了某个主题的电子邮件(如下):

tell application "Mail"
check for new mail
repeat until (background activity count) = 0
    delay 0.5
end repeat
try
    return subject of (first message whose read status is false and subject contains "New newsletter ordered by")
end try
end tell

现在AppleScript拒绝阅读电子邮件的主题。有什么想法吗?我假设有一个更新,它已经打破了,但我找不到任何相关的信息。

3 个答案:

答案 0 :(得分:0)

尝试

return subject of (first message of inbox whose read status is false and subject contains "New newsletter ordered by")

答案 1 :(得分:0)

我有一台10.7.4计算机,并且在没有找到这些属性的消息时会收到错误。如果有未读消息包含该主题,则脚本(显示“收件箱的第一条消息”的脚本)可以正常工作。

答案 2 :(得分:0)

这似乎对我有用,我首先必须选择第一条消息然后我才能得到这个主题:

tell application "Mail"
   set theInbox to inbox
   set theMessage to first message of theInbox whose read status is false
   tell front message viewer to set selected messages to {theMessage}
   set theMessages to (get selection)
   repeat with theMessage in theMessages
       get subject of theMessage as string
   end repeat
end tell