Re: Mailparse bug
| From: | Bertrand Mansion | Date: | Sun, 18 Jan 2004 20:03:43 +0000 |
| Subject: | Re: Mailparse bug | ||
| References: | 1 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-351@lists.php.net to get a copy of this message | ||
<bmansion@mamasam.com> wrote :
> Hi picklers,
>
> Here is the warning I get after parsing about 1000 mails with mailparse
> extension in a loop:
>
> PHP Warning: mimemessage(/web/archive/2001/tcpdumpwigginout.txt): failed to
> open stream: Too many open files in /web/parsebig_mailparse.php on line 75
>
>
> I got about 12000 messages to parse.
>
> Code :
>
> foreach ($files as $i => $file) {
>
> $msg =& new MimeMessage('file', $file);
> $header = $msg->data['headers'];
> // Do some cleanup of the headers
>
> unset($header);
> unset($msg);
> }
>
>
> Is this a mailparse bug ?
> If yes, do you know a workaround (apart from "reduce the number of mails you
> parse with mailparse ;)
Overlooked the obvious, I now use:
$mail = file_get_contents($file);
$msg =& new MimeMessage('var', $mail);
And it's much better.
Bertrand Mansion
Mamasam