Piping email into a php script

From: Date: Mon, 04 Apr 2005 19:13:07 +0000
Subject: Piping email into a php script
Groups: php.general 
Request: Send a blank email to php-general+get-212202@lists.php.net to get a copy of this message
Running PHP 4.3.9, apache, mysql, qmail I know it's possible to pipe an incoming mail message to a script in qmial by creating a .qmail file for the user like: |script What I'd like to do is pipe incoming mail for a specific user into a php script that parses it out (using mailparse I imagine) and puts the pieces into a database table. On PHP.net I see an example like this on the function page for Mailparse: [SNIP] <?php $buffer = [...] // Mail Content from pipe or whatever $mail = mailparse_msg_create(); mailparse_msg_parse($mail,$buffer); $struct = mailparse_msg_get_structure($mail); foreach($struct as $st) { $section = mailparse_msg_get_part($mail, $st); $info = mailparse_msg_get_part_data($section); print_r($info); } ?> [SNIP] This looks like it will work so long as I put the required database interface code in the "foreach" section. However I'm a little stuck on how to actually pipe the file into the script so that it winds up in the $buffer variable. Can anyone give me a clue as to how I can do this? Thanks, Jeff

« previous php.general (#212202) next »