On 12 Nov 2011, at 07:38, Ron Piggott wrote: > I am looking at CPanel’s “E-Mail filtering” option “Pipe To A Program” > http://docs.cpanel.net/twiki/bin/view/AllDocumentation/CpanelDocs/FilterOptions > > The goal I am working towards is saving the contents of an incoming e-mail address into a mySQL table. I am thinking of trying to program a customer contact center application. > > Does anyone know what variable the e-mail message is assigned within the context of “Pipe To A Program”? Is there a way to find out? I can’t figure this out. > > What I have tried so far is below: > > === > #!/usr/local/bin/php -q > <?php > > > foreach($_REQUEST as $key => $val) { > $$key = $val; > > $email_body .= "KEY: " . $key . "\r\n"; > $email_body .= "VAL: " . $val . "\r\n"; > $email_body .= "\r\n"; > > } > > mail( user@domain , "Test Pipe To Program" , $email_body ); > === > > The mail command works, but the e-mail message body is empty. I am at a loss of how to proceed. When you pipe email to a program the mail server literally does that - it pipes the contents of the email to the stdin of your program. In PHP you would then read the email contents like so... $email = file_get_contents('php://stdin'); Note that what you get is the raw email, complete with headers. When I do this in PHP I use the Mailparse extension: http://php.net/book.mailparse Here's a (somewhat over-complicated) example from an old version of TwitApps when I processed Twitter email notifications: https://gist.github.com/1360403 -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php