2012-03-07 43 views
0

我编写了一个将所选电子邮件移至垃圾箱的AppleScript。这个脚本在这方面效果很好。问题是电子邮件仍保留在服务器上。是否有额外的代码,我需要添加它来做到这一点?以下是代码: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 
+0

你使用pop,imap,exchange吗? – adayzdone 2012-03-07 02:55:40

+0

这是一个POP服务器:goDaddy。我有一条规则删除其他电子邮件。它在服务器上留下项目没有问题。 – curt 2012-03-07 07:22:31

+0

我试着评论了代码的各个部分。这是导致问题的第二行代码。我甚至将它移到另一个由另一个规则执行的脚本中。电子邮件仍保留在服务器上。 – curt 2012-03-12 16:29:09

回答

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 
+0

所有其他电子邮件正在从服务器上删除,所以我没有看到前两个命令有任何帮助。看起来消息必须在从服务器删除之前将其发送到收件箱。 – curt 2012-03-12 16:42:24

+0

单个规则不起作用。整个过滤器是(A或B或C或D)和(不是E或不是F)。第一部分是调用脚本的规则。规则必须是我所能说的全部或全部。我可以分成四个独立的规则,但我可能有更复杂的过滤器,我想学习AppleScript。正如我在第一篇文章的评论中提到的,我提出了一个解决方法。 – curt 2012-03-13 23:23:31

0

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

相关问题