1
現在Postfixサービスが稼働しており、電子メールを送受信しています。私はPHPスクリプトを実行するために "テスト"アドレスをエイリアスしようとしています。下のエイリアスファイルの抜粋を参照してください。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=<[email protected]>, size=1681, nrcpt=1 (queue active)
postfix/virtual[3435]: 02BE9472A: to=<[email protected]>, 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スクリプトが正常に呼び出されるが、私はいずれにも「エラー」を取得していないされていないかのように思えますログの
誰も経験したことがありますか? man aliases
|command
Mail is piped into command. Commands that contain special char-
acters, such as whitespace, should be enclosed between double
quotes. See local(8) for details of delivery to command.
When the command fails, a limited amount of command output is
mailed back to the sender. The file /usr/include/sysexits.h
defines the expected exit status codes. For example, use "|exit
67" to simulate a "user unknown" error, and "|exit 0" to imple-
ment an expensive black hole.
から
あなたはこれを追加した後、エイリアスファイルをリロードしましたか?いくつかのインストールには、 'newaliases'や' newaliases.postfix'というコマンドがあります。あるいは単にpostfixを再起動するだけです。 –
私はそれが失敗するとは思っていませんでしたが、私は空間を持つパイプエイリアスを見たことがありません。先頭のスペース 'test:"を削除してみてください| php -q /path/to/script.php "' –