|
Posted by Martijn Lievaart on March 13, 2008, 9:48 am
Please log in for more thread options
On Thu, 13 Mar 2008 01:41:37 -0700, Bart Van der Donck wrote:
> Hello,
>
> I'm reading an email inbox file in Perl like /usr/boxes/mydomain.com/
> info. This file consists of 1 or more mails that are waiting to be
> delivered. Which mechanism is safe enough to split this file in order to
> know the number of waiting emails ?
>
> The format looks like this:
>
> From jeff@domain.com Wed Mar 12 19:14:17 2008 [headers]
> [blanc line]
> [body]
> [blanc line]
> From john@domain.com Wed Mar 12 19:50:11 2008 [headers]
> [blanc line]
> [body]
> [blanc line]
> From kevin@domain.com Wed Mar 12 21:47:07 2008 [headers]
> [blanc line]
> [body]
>
> I don't understand how Perl can split this input reliably, so that it
> knows where a next mail starts. I mean, every message could also contain
> blanc lines or "From xx@xx.xx" itself.
The delimiter is '\n\nFrom'. It it occurs in the body it should be
escaped (by putting a '>' before the 'From' IIRC).
HTH,
M4
|