LoginSignup
14
12

More than 5 years have passed since last update.

Postfix でメール受信時に API 経由で処理を実行する

Posted at

メール受信時に、自動で内容の解析を行う処理を API 経由で行う必要があったため、その設定をメモします。

Postfix の alias の設定

API リクエストを送信するために alias ファイルに設定を追加

info@xxxxxx.xxx 宛てメールを受信したときに Curl でリクエストを送信する

[/etc/aliases]
info: "|xargs -0 -I% curl --url http://<URL> --data % > /dev/null"

newaliases コマンドで設定を反映する

PHP でリクエストを受け取る

$mailData = file_get_contents('php://input');

でメールのデータを取得できます。

14
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
12