Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing procmail to call a php script
    primarykey
    data
    text
    <p>I am attempting to do some custom email forwarding. #1 I am on a shared server, which is using qmail, and optionally procmail.</p> <p>What I am trying to accomplish is some custom email forwarding of one address, based on a schedule. For example, I have a schedule of employees that are working on each weekday, and I have a php script that selects a random employee's email address that is working today.</p> <p>So I'm trying to just call that script in procmail, and output the result(which is a single email address) on the forward line:</p> <p>Example:</p> <pre><code>#Something LOGFILE=/usr/home/myname/procmail-log VERBOSE=yes EXITCODE=99 MAILDIR=/usr/boxes/myname DEFAULT=/usr/boxes/myname/mybox SHELL=/bin/sh MYVAR=$(php -q /usr/home/myname/testemail/emailtester.php) :0 ! $MYVAR </code></pre> <p>This is not working. At all. I have also tried:</p> <pre><code>MYVAR=`php /usr/home/myname/testemail/emailtester.php` </code></pre> <p>as well as just piping it into the forward line:</p> <pre><code>:0 ! |php /usr/home/myname/testemail/emailtester.php </code></pre> <p>I am COMPLETELY out of my element here... I tried to not even use procmail, and I just piped the whole email over to a php script, from qmail. I need the headers to stay intact, like a normal forward, and that proved to be difficult with PHP, and a little beyond my scope.( I managed to create an infinite email loop) So, I would rather not try that again.</p> <p>I could just try to script this in perl, which I have never used, but I need the schedule to be administerable from a web interface, or at least in a user friendly way.</p> <p>Any help, or suggestions would be appreciated at this point, thanks</p> <p>EDIT:</p> <p>Well, since I cant put code in a comment, I'll just edit here.</p> <p>Now getting this in my log:</p> <pre><code>Folder: /usr/local/bin/php /usr/home/idnani/testemail/emailtester.ph 1679 "rocmail: Executing "/usr/local/bin/php,/usr/home/idnani/testemail/emailtester.php Could not open input file: /usr/home/idnani/testemail/emailtester.php </code></pre> <p>When I use with :0fw I get:</p> <pre><code>"rocmail: Executing "/usr/local/bin/php,/usr/home/idnani/testemail/emailtester.php Could not open input file: /usr/home/idnani/testemail/emailtester.php procmail: [69907] Thu Jun 16 14:04:17 2011 procmail: Program failure (1) of "/usr/local/bin/php" procmail: Rescue of unfiltered data succeeded </code></pre> <p>EDIT: Figured it out!</p> <p>Found the correct way after MUCH trial and error.</p> <p>Don't even use the pipe at, all, and you do need the ! forward symbol:</p> <p>Final Rule:</p> <pre><code>:0 ! `/usr/local/bin/php -f $HOME/emailtest/emailtester.php` </code></pre> <p>So simple... I'm a little mad it took me hours to figure this out, thanks everyone for helping to point me in the right direction!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload