Applescript将电子邮件移动到垃圾箱,但不从服务器删除

时间:2012-03-07 02:44:17

标签: applescript apple-mail

我写了一个AppleScript,将选定的电子邮件移到垃圾箱。该脚本在这方面工作正常。问题是电子邮件仍留在服务器上。我需要添加额外的代码来实现它吗?这是代码:

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 message_count to 1 by -1
            set this_message to item i of these_messages
            set this_content to (every character of content of this_message) as Unicode text
            if "bowles" is not in this_content and "patton" is not in this_content then
                set theAccount to account of mailbox of this_message
                set mailbox of this_message to mailbox "Trash" of theAccount
            end if
        end repeat
    end tell
end perform mail action with messages
end using terms from

2 个答案:

答案 0 :(得分:0)

如果没有看到可能导致问题的整个脚本和其他规则,则很难进行故障排除。尝试将停止评估规则操作添加到您的规则中:

enter image description here

using terms from application "Mail"
on perform mail action with messages these_messages for rule this_rule
    tell application "Mail"
        repeat with this_message in these_messages
            set this_content to content of this_message
            if "bowles" is not in this_content and "patton" is not in this_content then
                set theAccount to account of mailbox of this_message
                set junk mail status of this_message to false
                set mailbox of this_message to mailbox "Trash" of theAccount
            end if
        end repeat
    end tell
end perform mail action with messages
end using terms from

答案 1 :(得分:0)

可悲的是,答案似乎是为电子邮件来源创建单独的规则。最后,我刚刚从邮件列表中取消订阅,因为多年来我没有看到任何有用的信息。