...more recent posts
As usual, just more notes to myself.
I run qmail with virtual domains. To pipe incoming emails for a certain account (foo@example.com) through a PHP script you have to:
1) create a .qmail-foo file in /home/vpopmail/domains/example.com which contains the following line:
|/usr/bin/php -f /path/to/phpscript.php
2) the php script can read the raw email message from stdin like this:
$fd=fopen("php://stdin","r");
while(!feof($fd)){
$email.=fread($fd,1024);
}
fclose($fd);
This only works (I think this is right) if foo@example.com is *not* an actual mailbox in qmail. Also I did a qmailctl restart which I'm guessing is needed as well (after creating .qmail-foo file.)