applescript - 如何使用applescript打开电子邮件?

标签 applescript email

我正在编写一个小苹果脚本,它检索查看器中的所有“未读”消息并循环它们。

我有两个目标要完成:

  • 我需要获取每条消息的主题并执行正则表达式以查看它是否适合第 2 步(例如:获取主题为 {.*} 的电子邮件)
  • 我需要在单独的窗口中打开每条消息,4 秒后,我需要关闭该窗口并继续处理下一条消息

  • 你知道怎么做这些吗?

    提前致谢。

    最佳答案

    以下 applescript 对我有用,但我不确定如何进行正则表达式匹配。您可以将unix 'grep' 函数与applescript 的' do shell script 一起使用。 ' 命令,但我不是如何正确使用 grep 的专家。我将把它留给其他人来回答。

    
    on run
        tell application "Mail"
            set myInbox to mailbox "INBOX" of account 1
            set myMessages to every message of myInbox
    
            repeat with theMessage in myMessages
                if read status of theMessage is false then
    
                    if my subjectIsInteresting(subject of theMessage) then
                        open theMessage
                        delay 4
                        close window 1
                    end if
    
                end if
            end repeat
    
        end tell
    end run
    
    on subjectIsInteresting(subject)
    
        -- do some regex magic here
    
        return true -- for now
    
    end subjectIsInteresting
    

    关于applescript - 如何使用applescript打开电子邮件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/390381/

    相关文章:

    applescript - AppleScript 中的 POSIX 路径

    macos - 从条形码扫描仪捕获输入,写入浏览器窗口

    php - SSL 证书因根用户而异

    php - 无法使用 PHP mail() 发送 HTML 邮件

    email - 通过 SES 自动回复通过 SES 收到的电子邮件

    objective-c - 以编程方式修改 osx 中的屏幕边界

    javascript - 将 AppleScript if 子句翻译为其 JavaScript 等效项

    java - Applescript 相当于 "jump to line n#"

    html - outlook 2010 电子邮件背景颜色 html/css 属性不起作用

    asp.net - GoDaddy 发送电子邮件