这是为了处理垃圾邮件。现在我知道得更清楚了,每次我们打开一封垃圾邮件,垃圾邮件发送者都知道邮件id是有效的。将其标记为垃圾邮件或执行任何操作都没有帮助。
现在我的问题来了。我正在寻找我的Applescript的帮助。
下面是我想在运行脚本时遵循的逻辑
找到发件人电子邮件id解析以获取域名(我被困在这里了)
将域名添加到特定的邮件规则"Addedfilter“作为条件(这是可选的,如果我可以自动执行此部分的话就更好了)
我打算通过邮件服务使用它,以便将发件人ids的域名收集到我的邮件规则中。
tell application "Mail"
set theSelection to selection
set theMessage to item 1 of theSelection
set theSender to sender of theMessage
--set theDomain to (do shell script "cut -f1 -d'@' $1" & quoted form of theSender)
set theDomain to (do shell script "awk -F\"@\" '{print $2}'" & quoted form of theSender)
display dialog theDomain
end tell注:标记“垃圾邮件”无济于事。此外,我也有一些动机来捕获垃圾邮件域ids。
发布于 2013-03-28 06:46:15
尝试执行以下操作以获取域:
set theDomain to (do shell script "echo " & quoted form of rich text 1 through -2 of theSender & " | awk " & quoted form of "{split($0,a,\"@\"); print a[2]}")或者这样:
set theDomain to (do shell script "echo " & quoted form of rich text 1 through -2 of theSender & " | awk -F \"@\" '{print $2}' $1")然后,如果要将域条件添加到规则中,请执行以下操作:
set r to rule "Addedfilter"
tell r
make new rule condition at end of rule conditions with properties {expression:theDomain, qualifier:does contain value, rule type:from header}
end tell发布于 2021-04-15 16:30:40
获取域名的另一种方法:
set theSelection to selection
set theMessage to item 1 of theSelection
set theEmail to extract address from sender of item 1 of theMessage
set AppleScript's text item delimiters to "@"
set theDomain to text item 2 of theEmail在这里找到它:https://forum.keyboardmaestro.com/t/extract-domain-name-from-current-email-and-open-in-safari/2904/5
https://stackoverflow.com/questions/15670363
复制相似问题