Re: Pipe an email to PHP
| From: | David T-G | Date: | Wed, 27 Aug 2003 13:45:17 +0000 |
| Subject: | Re: Pipe an email to PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-160906@lists.php.net to get a copy of this message | ||
Thomas --
..and then Thomas Tremain said...
%
% I'm sure this question has been visited before, but I've had some troubles
% searching through
% the archives.
What sort of trouble? Just trouble finding a helpful answer, or actual
trouble performing a search?
%
% This is at least a two part question.
%
% I wish to use a pipe instead of the pop3 class, because I wish the email to
% start the script
% instead of waiting for a cronjob.
Makes sense.
%
% 1) The pipe itself:
% On a cPanel server, I wish to setup an email address with a pipe like:
% script@mydomain.com <mailto:script@mydomain.com> :
% |/home/account/public_html/mailtools/emailscript.php
%
% This always gives me an error saying it cannot foraward.
Is emailscript.php marked as executable and does it have a proper shebang
line at the top?
%
% If I pipe it to "|/usr/bin/php
% /home/account/public_html/mailtools/emailscript.php"
% it tells me: "No input file specified."
Hmmm... How does your code look?
%
% 2) to read the data:
%
% I wish to parse the data into $from $subject and $body
Greg's STDIN suggestion sounds good to me. Read the thing in and look
for ^From:, ^Date:, and ^$; everything after the blank line is the body.
Strip the signature for bonus points.
%
% The data will then be manipulated, and key pieces of data will be extracted
% and sent to either a database or an instant message to my cell phone. (this
% part I've already solved)
Well, that's something ;-)
%
%
% Thomas Tremain
% www.LiveHost.net <http://www.LiveHost.net>
% www.GotoNames.com <http://www.GotoNames.com>
% www.TrafficExaminer.com <http://www.TrafficExaminer.com>
HTH & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg@justpickone.org * society and not sufficient moral courage.
(work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur
Pbzzhavpngvbaf Qrprapl Npg!