Pipe Emails

Discussion in 'General' started by kippi, Oct 28, 2007.

  1. kippi

    kippi New Member

    Hey,

    I am trying to write a script for my ISPConfig install. I am trying to pipe an e-mail to my php script but I am getting this error:

    cannot append message to destination file
    /var/www/web7/web/network/email/email.php: cannot open file: Permission denied

    This is my config:

    .forward:

    |/usr/bin/php /var/www/web7/web/network/email/email.php

    email.php: chown - postfix:postfix chmod - 755

    <?php
    // read from stdin
    $fd = fopen("php://stdin", "r");
    $email = "";
    while (!feof($fd)) {
    $email .= fread($fd, 1024);
    }
    fclose($fd);
    $message = 'bla' ;
    mail('chris@skateeast.net', 'Backups', $message);
    ?>

    Any help would be great!!!

    Many Thanks

    Chris.
     
  2. kippi

    kippi New Member

    Ok,

    I have made some changes and this is not working, I am going to look at other ways of doing this.
     
  3. falko

    falko Super Moderator

    What's the output of
    Code:
    ls -la /var/www/web7/web/network/email
    ?
     
  4. kippi

    kippi New Member

    Hey,

    This is the out put:

    -rwxr-xr-x 1 web7_techtest phpmyadmin 211 2007-10-28 18:01 email.php


    Many Thanks
     
  5. falko

    falko Super Moderator

    Can you post the full output? I wanted to see the permissions of /var/www/web7/web/network/email as well.
     
  6. kippi

    kippi New Member

    ah sorry!!!

    total 44
    drwxr-xr-x 3 root root 4096 2007-10-29 02:43 .
    drwxrwxrwx 11 root root 4096 2007-10-31 12:27 ..
    -rwxrwxrwx 1 root root 2247 2007-10-27 17:47 attachmentread1.class.php
    -rwxrwxrwx 1 root root 3651 2007-10-28 00:09 attachmentread.class.php
    -rwxr-xr-x 1 postfix postfix 307 2007-10-28 17:50 email1.php
    -rwsr-sr-x 1 web7_techtest phpmyadmin 211 2007-10-28 18:01 email.php
    -rwxrwxrwx 1 root root 495 2007-10-28 23:56 readattachment.php
    -rw------- 1 root root 478 2007-10-29 02:43 readattachment.php.save
    drwxr-xr-x 2 root root 4096 2007-10-28 00:06 test
    -rw-r--r-- 1 root root 804 2007-10-28 00:19 test.php
    -rw-r--r-- 1 root root 23 2007-10-29 00:32 test.pl
     
  7. kippi

    kippi New Member

    Sorry

    ah sorry!!!

    total 44
    drwxr-xr-x 3 root root 4096 2007-10-29 02:43 .
    drwxrwxrwx 11 root root 4096 2007-10-31 12:27 ..
    -rwxrwxrwx 1 root root 2247 2007-10-27 17:47 attachmentread1.class.php
    -rwxrwxrwx 1 root root 3651 2007-10-28 00:09 attachmentread.class.php
    -rwxr-xr-x 1 postfix postfix 307 2007-10-28 17:50 email1.php
    -rwsr-sr-x 1 web7_techtest phpmyadmin 211 2007-10-28 18:01 email.php
    -rwxrwxrwx 1 root root 495 2007-10-28 23:56 readattachment.php
    -rw------- 1 root root 478 2007-10-29 02:43 readattachment.php.save
    drwxr-xr-x 2 root root 4096 2007-10-28 00:06 test
    -rw-r--r-- 1 root root 804 2007-10-28 00:19 test.php
    -rw-r--r-- 1 root root 23 2007-10-29 00:32 test.pl
     
  8. falko

    falko Super Moderator

    Looks ok. Do you get any errors when you run
    Code:
    /usr/bin/php /var/www/web7/web/network/email/email.php
    on the shell?
     
  9. kippi

    kippi New Member

    I don't get any errors, it just sits there, and does nothing.

    Thanks

    Chris.
     
  10. falko

    falko Super Moderator

    That's ok.

    What happens if you do this as the user that should receive the mail?
     
  11. kippi

    kippi New Member

    Ok, ran it as web7_user and still get no errors.

    Many Thanks
     

Share This Page