【问题标题】:Applescript Mail - Script won't get past ''on perform mail action with messages theMessages for rule theRule"Applescript Mail - 脚本不会通过“在执行邮件操作时使用消息 theMessages for rule theRule”
【发布时间】:2020-11-05 19:42:07
【问题描述】:

我已经设置了一个规则,当一封来自某个发件人的电子邮件时,Applescript 会被触发。我希望 Applescript 从邮件中提取触发规则的内容,以将其发送到 PHP 脚本,该脚本将其作为 webhook 发送到数据库。 一切正常,除了代码不会运行过去'on perform mail action with messages theMessages for rule theRule',它只是跳过该代码块并且永远不会到达重复块。

我做错了什么?

如果您需要更多信息,我很乐意提供。

提前致谢!

set d_recd to missing value
set theText to missing value
set theSender to missing value

using terms from application "Mail"
    on perform mail action with messages theMessages for rule theRule
        repeat with theMessage in theMessages
            set theDate to date recieved of theMessage
            set theText to content of theMessage
            set theSender to sender of theMessage
        end repeat
    end perform mail action with messages
end using terms from
do shell script ("php -q /Users/kaartendrukkerijmacmini/Dropbox/Technische_ontwikkeling/PHP_Webhook_approval_post.ctp " & d_recd & space & theText & space & theSender)

【问题讨论】:

    标签: applescript


    【解决方案1】:

    do shell script 行必须在处理程序内。而且您必须引用所有参数并将theDate 强制转换为文本。

    最后有个错字:date received

    using terms from application "Mail"
        on perform mail action with messages theMessages for rule theRule
            repeat with theMessage in theMessages
                set theDate to date received of theMessage
                set theText to content of theMessage
                set theSender to sender of theMessage
                do shell script "php -q /Users/kaartendrukkerijmacmini/Dropbox/Technische_ontwikkeling/PHP_Webhook_approval_post.ctp " & quoted form of (theDate as text) & space & quoted form of theText & space & quoted form of theSender
            end repeat
        end perform mail action with messages
    end using terms from
    

    如果根本没有调用处理程序,问题就在其他地方。

    【讨论】:

      猜你喜欢
      • 2012-04-17
      • 1970-01-01
      • 2011-05-17
      • 1970-01-01
      • 2020-05-04
      • 2012-09-20
      • 1970-01-01
      • 2012-08-23
      相关资源
      最近更新 更多