Re: Can a PHP program recieve an e-mail and write it to a file???

From: Date: Thu, 18 Jan 2001 23:28:44 +0000
Subject: Re: Can a PHP program recieve an e-mail and write it to a file???
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-35507@lists.php.net to get a copy of this message
On Thu, 18 Jan 2001, Chris Hayes wrote: > > > Date sent: Thu, 18 Jan 2001 15:20:24 -0500 (EST) > From: Ignacio Vazquez-Abrams <ignacio@openservices.net> > To: Jeremy Bowen <ocarules@webnationinc.com> > Copies to: <php-general@lists.php.net> > 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 (chayes@antenna.nl) > 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 myscript@whateveryourdomainis.com, 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 <ignacio@openservices.net>

« previous php.general (#35507) next »