我编写了一个由邮件规则调用的脚本。我希望脚本在某些条件下将邮件移动到垃圾箱。它没有用,所以我已经注释掉了测试,它仍然没有用。我从在线教程中获得了代码。本教程将消息移至“归档”。当我用移动到垃圾箱替换对脚本的调用时,规则本身就起作用了。这是我正在测试的内容:
using terms from application "Mail"
on perform mail action with messages these_messages for rule this_rule
tell application "Mail"
set the message_count to the count of these_messages
repeat with i from 1 to the message_count
set this_message to item i of these_messages
-- try
-- set this_content to (every character of content of this_message) as Unicode text
-- if this_content is in {"", "?"} then error
-- if "bowles" is not in this_content and "patton" is not in this_content then
set mailbox of this_message to mailbox "Trash"
-- end if
-- on error error_message
-- set this_content to "NO CONTENT"
-- end try
end repeat
end tell
end perform mail action with messages
结束使用条款
有争议的声明是:将this_message的邮箱设置为邮箱“垃圾箱”
其余的活动代码来自 AppleScript Editor 模板。
谢谢,柯特
PS 有没有关于使用 AppleScript 和 Mail 的书?