我目前正在运行 Postfix 服务,可以正常发送和接收电子邮件。我正在尝试使用别名“测试”地址来运行 PHP 脚本。请参阅下面的别名文件摘录。
test: "| php -q /var/blahblahblah/php/test.php"
这是test.php的内容。这似乎在命令行中正确运行。
#!/usr/bin/php
<?php
$file = fopen("/tmp/postfixtest", "a");
fwrite($file, "Script successfully ran at ".date("Y-m-d H:i:s")."\n");
fclose($file);
?>
下面是 mail.log 的摘录,显示了感兴趣的主要行。
postfix/qmgr[3427]: 02BE9472A: from=<sender@email.com>, size=1681, nrcpt=1 (queue active)
postfix/virtual[3435]: 02BE9472A: to=<test@domain.com>, relay=virtual, delay=0.45, delays=0.42/0.01/0/0.02, dsn=2.0.0, status=sent (delivered to maildir)
postfix/qmgr[3427]: 02BE9472A: removed
请注意括号中的传递到 maildir 位。这应该说“交付给脚本”之类的东西吗?
现在所有文件都设置为 777 权限,别名文件通过使用保持更新sudo newaliases
似乎 PHP 脚本没有被正确调用,但我在任何日志中都没有收到“错误”。
有没有人经历过或解决过这个问题?