Reply to Re: [PHP] Piping email into a php script

Your name:

Reply:


Posted by Philip Hallstrom on 04/04/05 23:00

$buffer = file_get_contents("php://stdin");

will read the contents of standard input into the string $buffer.

-philip

On Mon, 4 Apr 2005, Jeff McKeon wrote:

> 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
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация