我尝试编写脚本会在不到一小时内选择第一封电子邮件并抓取电子邮件,然后在不到一小时后自动选择下一封电子邮件并抓取电子邮件,直到电子邮件大于小时。
我可以抓住第一封电子邮件,但获得第二封电子邮件是我无法思考如何做的。
方向是我正在寻找的,而不仅仅是答案,我只需要从哪里开始。
tell application "Mail"
set theMessage to message 1 of mailbox "INBOX" of account "Google"
set theDate to date received of theMessage
if theDate is less than the (current date) and (theDate) is greater than ((current date) - (1 * hours)) then
set theEmail to the (address of to recipient of theMessage)
end if
end tell
答案 0 :(得分:0)
尝试将代码封装在重复循环中:
repeat with oneMessage in every message of mailbox "INBOX" of account "Google"
set theDate to date received of theMessage
--Conditional analysis
end repeat
此代码的主要问题是您的INBOX中可能有大量消息,从而导致脚本陷入困境。
另一个选择是在一个命令中抓取不到一个小时的所有消息,然后处理结果列表:
set oneHourMessages to every message of mailbox "INBOX" of account "Google" whose date received is less than the (current date) and date received is greater than ((current date) - (1 * hours))
祝你好运,