在中查找最近标记的邮件邮件.app使用appscript

【在中查找最近标记的邮件邮件.app使用appscript】盛年不重来,一日难再晨,及时当勉励,岁月不待人。这篇文章主要讲述在中查找最近标记的邮件邮件.app使用appscript相关的知识,希望能为你提供帮助。

  1. #!/usr/bin/env ruby
  2.  
  3. require " rubygems"
  4. require " appscript"
  5. include Appscript
  6. require " active_support"
  7.  
  8. mail = app( " Mail" )
  9.  
  10. accounts = { " Personal" => " INBOX" ,
  11. " Both Pieces IMAP" => " INBOX" ,
  12. " Exchange" => " INBOX" }
  13.  
  14. accounts.each do |acct,box|
  15.  
  16. account = mail.accounts[ acct] .get
  17. inbox = account.mailboxes[ box] .get
  18. messages = inbox.messages[ its.flagged_status.eq( true) .and(
  19. its.date_received.gt( Time.now - 3.days)
  20. ) ] .get
  21.  
  22. messages.each do |m|
  23. puts m.subject.get
  24. end
  25.  
  26. end
  27.  
  28.  


    推荐阅读