On Thu, 18 Jan 2001, Chris Hayes wrote:

>
>
> Date sent:            Thu, 18 Jan 2001 15:20:24 -0500 (EST)
> From:                 Ignacio Vazquez-Abrams <[EMAIL PROTECTED]>
> To:                   Jeremy Bowen <[EMAIL PROTECTED]>
> Copies to:            <[EMAIL PROTECTED]>
> Subject:              Re: [PHP] Can a PHP program recieve an e-mail and write it to a
>       file???
>
> Jeremy Bowen wrote:
> > > Here is what I need to do, I need to have a PHP script recieve an e-mail
> > > and write it to a file after erasing whatever was in the file before.
>
> Ignacio Vazquez-Abrams  replied:
> > If you're using sendmail, you can set up an alias to execute a program and
> > send the message to the program's standard input whenever the message is
> > sent to an arbitrary address.
>
> Wow, that sounds GREAT, much better than what i just suggested (connecting
> to POP mailbox, reading and dissecting email).
>
> I was convinced sendmail could only SEND mail. I mean, it's name suggested
> that.
> How can i set it up to get all email to a certain address to a php file?
>
> Chris H
>
> "The dumber people think you are, the more
> surprised they will be when you kill them."
>          ---- William Clayton
>
> Chris, in the NL    ([EMAIL PROTECTED])
>

In your /etc/aliases (surprise!) file put a line like the folloing (fixing
all the paths up, of course):

myscript   "|php -q myscript.php"

Then whenever you send a message to [EMAIL PROTECTED], it will
be fed into standard input (php://stdin, IIRC) for myscript.php.

For more information I strongly suggest you take a look at a book about
sendmail. I personally refer to the one by O'Reilly, but there may be simpler
books out there.

Also, I hate to say this in a mailing list about PHP, but I don't believe that
it's the best language for the job. It's great for web stuff, but there are
probably better choices for non-web scripts.

-- 
Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to