Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )

Advanced DNS Management
New ZoneEdit. New Managment.


Sign Up Now
Reply to this topicStart new topic
> Piping Emails To Php Script, Help please
post Sep 18 2005, 04:31 PM
Post #1

Whats this Lie-nix Thing?

Group: Members
Posts: 1
Joined: 18-September 05
Member No.: 5,529

I've been trying to pipe incoming emails to a php script for the past one week but to no avail. I've tried my level best. Googled around.. read dozens of articles... followed all instructions YET fail to achieve this. If anyone can PLEASE help me with this.... Here are the details.
I want an email sent to run a file /var/websites/

I've made the following modification in /etc/aliases
[quote]upload:      "|/var/websites/"[/quote]
executed 'newaliases' for it to take effect.

My php script which is located at /var/websites/ is THIS
#!/usr/local/bin/php -q
    $ifp = fopen('hello.txt', "wb");
    fwrite($ifp, 'Yo');

As you can see upon execution, this should create a hello.txt file in the same directory i.e. /var/websites/

I've also done THIS to give send mail root shell access to php.
[quote]ln -s /usr/local/bin/php /etc/smrsh/php[/quote]

Now Finally upon sending an email, the script isn't being executed and i get the following message:

[quote]Sep 18 20:37:00 vps sendmail[15158]: STARTTLS=server: file /etc/mail/certs/cert.pem unsafe: No such file or directory
Sep 18 20:37:00 vps sendmail[15158]: j8IJb0MM015158: from=<>, size=1198, class=0, nrcpts=1, msgid=<000901c5bc88$56ae8820$0100a8c0@p4>, proto=ESMTP, []
Sep 18 20:37:01 vps sendmail[15165]: j8IJb0MM015158: to="|/var/websites/", ctladdr=<> (8/0), delay=00:00:01, xdelay=00:00:01, mailer=prog, pri=31407, dsn=2.0.0, stat=Sent

Please if anyone can help..
O.S.: Fedora Core 2
MTA: Sendmail
Go to the top of the page
+Quote Post
post Sep 19 2005, 10:30 AM
Post #2

Its GNU/

Group: Support Specialist
Posts: 1,284
Joined: 14-November 04
From: Southampton, Hampshire
Member No.: 4,165

The easisest way to do so, is to use a .forward file. The email can be piped to a prcess and read fromSTDIN (php://stdin can be sued just like a regular file, ie with fopen and fgets)

There is quite a lot of info, i'll have a look through my bookmarks and see if i can find the site I use

* Moving to Programming Section *


Fixed your problem? Let us know! Online Event Management
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:


RSS Lo-Fi Version Time is now: 21st October 2017 - 03:47 AM