我希望能够在苹果的 mail.app 中的邮箱中搜索某个短语或单词,然后以某种方式返回或复制从搜索结果中成功返回的电子邮件所发送的所有电子邮件地址来自..如果你明白我的意思
我认为做到这一点的唯一方法可能是 applescript,但如果其他人知道任何其他方法,请告诉我:)
最佳答案
Mail.app 不允许直接通过 Applescript 进行搜索,但这可以解决问题,尽管它有点慢,因为它必须遍历每条消息:
global searchTerm
property emailList : {}
set searchTerm to "aSearchTerm"
tell application "Mail"
set theInbox to inbox
set firstMessage to 1
set lastMessage to (get count of messages in theInbox)
repeat with thisMessage from firstMessage to lastMessage
set currentMessage to message thisMessage of theInbox
set messageContent to content of currentMessage
if messageContent contains searchTerm then
set end of emailList to sender of currentMessage
end if
end repeat
end tell
return emailList
关于使用 Applescript 搜索 Mail.app 的邮箱,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1916755/