Jump to content

PHP script invoked from postfix doesn't appear to run


genebom

Recommended Posts

Hi -

 

I'm not sure if this is the right place for this. If not

can someone please point me to an appropriate place?

 

That said, I've been trying to invoke a php script from the

postfix mta. the Email is delivered just fine to 'localuser',

the postfix log shows no errors, yet there is no indication

that the script ever ran. All the script does is create

several files and ouput some text to them. Works fine from

the console.

 

Anyone have any ideas how to go forward troubleshooting this?

 

Thanks,

Gene

 

Details follow below ...

 

 

Postfix runs as user 'postfix'.

 

Script permissions are:

 

-rwxrwxrwx  1 postfix  localuser      236 Apr 27 08:47 test4.php

 

 

 

From /etc/mail/aliases:

 

testuser:          localuser, "|/usr/local/bin/php -q /home/localuser/testmail/test4.php"

 

I've also tried:

 

testuser:          localuser, "/home/localuser/testmail/test4.php"

 

with #!/usr/local/bin/php as the first line in the php script.

 

 

 

The following is from Postfix's log file (Times & other irrelevant junk removed):

 

brightstar postfix/local[39848]: 8645B385: to=<localuser@domain.net>,

    orig_to=<testuser@brightstar.domain.net>, relay=local, delay=0.19,

    delays=0.16/0.01/0/0.02, dsn=2.0.0, status=sent (delivered to mailbox)

 

brightstar postfix/local[39848]: 8645B385: to=<testuser@brightstar.domain.net>,

    relay=local, delay=0.31, delays=0.16/0.01/0/0.14, dsn=2.0.0, status=sent

    (delivered to command: /usr/local/bin/php -q /home/localuser/testmail/test4.php)

 

brightstar postfix/qmgr[1017]: 8645B385: removed

 

 

 

 

The script:

 

<?php

 

$pta = fopen('pointa', 'w');

 

fputs($pta,"Success pta\n");

fclose($pta);

 

$ptb = fopen('pointb', 'w');

 

fputs($ptb,"Success ptb\n");

fclose($ptb);

 

 

$ptc = fopen('pointc', 'w');

 

fputs($ptc,"Success ptc\n");

fclose($ptc);

 

 

 

?>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.