我是 Applescript 的新手。我有一个特定的电子邮件帐户,仅用于接收带有附加图像的错误报告。邮箱可以很快填满。
我希望能够运行一个脚本来删除超过两天的邮件,所以我尝试了以下脚本。
我想纠正我写的东西,这样我就可以从错误中吸取教训,而不是使用不同的方法。寻找一些建设性的批评:
set daysToPreserve to 2
tell application "Mail"
activate
set mailboxList to mailbox "INBOX" of account “MyAccount"
repeat with theCurrentMailbox in mailboxList
set emailList to (every message of (mailbox theCurrentMailbox of account “MyAccount") whose date received is less than or equal to ((current date) - daysToPreserve * days))
if (count mailboxList) is greater than 0 then
move mailboxList to mailbox "Trash" of account “MyAccount"
end if
end repeat
end tell
display dialog "Old Mail Messages Have Been Purged" buttons ["OK"]