Applescript按主题删除邮件

时间:2015-06-18 15:10:55

标签: email applescript

有没有办法删除主题的邮件,我试图制作一个删除邮件的Applemans,来自我发送的'发送的邮件。邮箱。我用测试邮件试过这些脚本:

    tell application "Mail"
    set theMails to every message of (every mailbox whose name is "Sent") whose subject is "Test Mail"
delete theMails
    end tell

tell application "Mail"
set theMails to {every message of inbox "Sent" whose subject is "Test Mail"}
delete theMails
end tell

这两个脚本都不起作用,我不理解返回的错误,所以我找不到解决方案。帮助appriciated!

1 个答案:

答案 0 :(得分:1)

下面的代码有效。最好使用单词“contains”而不是尝试主题的完全匹配

tell application "Mail"
    set theMails to {every message of sent mailbox whose subject contains "Test Mail"}
    delete theMails 
end tell