HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   General (http://www.howtoforge.com/forums/forumdisplay.php?f=15)
-   -   Pipe Emails (http://www.howtoforge.com/forums/showthread.php?t=16665)

kippi 28th October 2007 18:52

Pipe Emails
 
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.

kippi 28th October 2007 19:17

Ok,

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

falko 29th October 2007 15:57

What's the output of
Code:

ls -la /var/www/web7/web/network/email
?

kippi 29th October 2007 16:37

Hey,

This is the out put:

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


Many Thanks

falko 30th October 2007 17:47

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

kippi 31st October 2007 19:37

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

kippi 31st October 2007 19:38

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

falko 1st November 2007 19:06

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?

kippi 2nd November 2007 16:07

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

Thanks

Chris.

falko 3rd November 2007 10:35

That's ok.

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


All times are GMT +2. The time now is 12:31.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.