简体   繁体   English

使用Applescript删除邮件中的邮件不会传播到iCloud

[英]Delete message in Mail using Applescript doesn't propagate to iCloud

I have an Applescript that performs a lookup when a new mail lands in my Mail inbox to check whether I have blacklisted the e-mail's domain or not. 我有一个Applescript ,当有新邮件进入我的Mail收件箱时,它会执行查找,以检查我是否已将该电子邮件的域列入黑名单。

If the e-mail domain is blacklisted, the script deletes the mail by doing so: 如果电子邮件域被列入黑名单,脚本将通过以下方式删除邮件:

tell application "Mail"
  delete blackListedMailMessage
end tell

Pretty straightforward. 非常简单。 My e-mails are properly filtered according to this blacklist of mine and moved to my trash mailbox, as I expect them to be. 我的电子邮件已根据我的黑名单进行了正确过滤,并按照我期望的那样移动到了我的垃圾箱。

The problem comes when I click the "Get messages" button in Mail: Mail retrieves the deleted messages from the server and put them back in my inbox. 当我单击“邮件”中的“获取邮件”按钮时,就会出现问题:邮件从服务器中检索已删除的邮件,并将它们放回我的收件箱中。 It seems the deletion doesn't propagate to the server. 似乎删除不会传播到服务器。 If I manually select the e-mail in Mail.app and hit delete, this does not happen. 如果我在Mail.app中手动选择电子邮件并单击Delete,则不会发生。

I'm pretty newb with Applescript, so I'm not sure what's all going on. 我对Applescript相当陌生,所以我不确定发生了什么。 My guesses are either the Mail.app's Applescript implementation is janky or it's iCloud. 我的猜测是Mail.app的Applescript实现是简陋的还是iCloud。 It could be both... 可能都是...

Okay, so I'll answer my own question... 好吧,我会回答我自己的问题...

It seems that Apple's implementation of Mail.app's Applescript delete is bugged. 看来Apple对Mail.app的Applescript delete的实现存在问题。

Instead, use: 而是使用:

tell application "Mail"
  move aMessage to trash mailbox
end tell

Otherwise, it will not propagate to the server if using iCloud. 否则,如果使用iCloud,它将不会传播到服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM