Applescript 邮件 - 脚本不会通过“使用规则 theRule 的消息 theMessages 执行邮件操作”

Applescript Mail - Script won't get past ''on perform mail action with messages theMessages for rule theRule"

我设置了一个规则,当一封来自特定发件人的电子邮件被触发时,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)

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

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