参考元
お名前.comのVPSで、メールの内容をプログラムに転送。
お名前.comのVPSでOpenPNE3(キャッチオール編)
私のところのお名前.comのVPS アップデートカスタムCentOS5.5での設定になります。
postmapのパスが通らなかったくらいで、あとは情報元と同じようにできました。
併せてご覧ください。
VPSのコントロールパネルからアドレスの新規登録は要りません。「架空」のユーザで設定できます。
が、ドメインだけは当然自分の持ち物で設定しないとダメですよね。
以下、sshの操作例
—
# vi /etc/postfix/virtual_alias_maps
(空っぽだったので、以下の行を追加。自前のドメインで自由に設定できます。)
regist@example.com regist
(とか、)
touroku@example.com hoge
(アドレスを右の文字列に変換しちゃうよ。という意味です。
改行による複数指定(個別)や、複数のアドレスを同じ名前に送ることもできます。
編集が終わったら、esc→:wq!で保存して、以下virtual_alias_maps.dbの更新作業です。)
# postmap /etc/postfix/virtual_alias_maps
bash: postmap: command not found
(おっと、パスが通ってない模様)
# find -name postmap
./usr/sbin/postmap
(見つけました。更新してみます。)
# /usr/sbin/postmap /etc/postfix/virtual_alias_maps
(で、virtual_alias_maps.db を更新。)
# vi /etc/aliases
(/etc/aliasesにコマンドを設定することで受信したメールhogeの内容をプログラムに渡すことができます。
以下を追加)
hoge: “|/usr/bin/php /var/www/vhosts/example.com/bin(一応httpdocsでも可)/(受信・処理するPHP).php
(esc→:wq!で保存して、以下aliasの更新作業です。)
# newaliases
(最後に、postfixを再起動してください。)
# /etc/rc.d/init.d/postfix restart
postfix を停止中: [ OK ]
postfix を起動中: [ OK ]
動作確認するPHPは参考ページのものを上記に合わせて以下のようにしました。
binにアップするファイル2点。
1)(受信・処理するPHP).php パーミッション:644
#!/usr/bin/php
$in = fopen(‘php://stdin’, ‘r’);
$out = fopen(‘/var/www/vhosts/example.com/bin/hoge_output.txt’, ‘w’);
while ($line = fgets($in))
{
fwrite($out, $line);
}
2)hoge_output.txt パーミッション:666
以降はまだ実践していませんが、参考記事:
空メールでユーザ登録
I confine take place upon upon someone to your blog countless times. The added articles are incredibly captivating and interesting. I unswerving to signup payment your rss fodder, so I can mob away advised of your mod editorials.
Great article. Waiting for more.
Nice post. I was checking constantly this blog and I am impressed! Extremely useful info specially the last part
I care for such info much. I was seeking this particular information for a very long time. Thank you and best of luck.
When I stumble upon a good blog post I go ahead and do a few things:1.Show it to all the relevant friends.2.save it in all my common bookmarking websites.3.Be sure to return to the site where I read the article.After reading this article I’m really thinking of doing all 3.
Hey, can I ask how long you spend researching before making a post like this? I’m thinking about writing similar articles! Thanks
I have study a couple of the articles on your website today, and I truly like your way of blogging. I bookmarked it to my bookmark site list and will be checking back soon. Pls check out my internet site too and let me know your thought.
Keep it up!! Good work..
Excellent blog you have there, thanks for sharing, iv bookmaked you!