Which split delimiter to use for mailbox

B

Bart Van der Donck

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 (e-mail address removed) Wed Mar 12 19:14:17 2008
[headers]
[blanc line]
[body]
[blanc line]
From (e-mail address removed) Wed Mar 12 19:50:11 2008
[headers]
[blanc line]
[body]
[blanc line]
From (e-mail address removed) 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 (e-mail address removed)" itself.

Thanks,
 
M

Martijn Lievaart

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 (e-mail address removed) Wed Mar 12 19:14:17 2008 [headers]
[blanc line]
[body]
[blanc line]
From (e-mail address removed) Wed Mar 12 19:50:11 2008 [headers]
[blanc line]
[body]
[blanc line]
From (e-mail address removed) 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 (e-mail address removed)" 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
 
C

ccc31807

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 (e-mail address removed) Wed Mar 12 19:14:17 2008
[headers]
[blanc line]
[body]
[blanc line]
From (e-mail address removed) Wed Mar 12 19:50:11 2008
[headers]
[blanc line]
[body]
[blanc line]
From (e-mail address removed) 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 (e-mail address removed)" itself.

Thanks,

Count the '^Froms'. That will give you an accurate count of the number
of separate messages and you don't need a delimiter.

CC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top