Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Which split delimiter to use for mailbox

Reply
Thread Tools

Which split delimiter to use for mailbox

 
 
Bart Van der Donck
Guest
Posts: n/a
 
      03-13-2008
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 http://www.velocityreviews.com/forums/(E-Mail Removed) Wed Mar 12 19:14:17 2008
[headers]
[blanc line]
[body]
[blanc line]
From (E-Mail Removed) Wed Mar 12 19:50:11 2008
[headers]
[blanc line]
[body]
[blanc line]
From (E-Mail 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 Removed)" itself.

Thanks,

--
Bart
 
Reply With Quote
 
 
 
 
Martijn Lievaart
Guest
Posts: n/a
 
      03-13-2008
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 (E-Mail Removed) Wed Mar 12 19:14:17 2008 [headers]
> [blanc line]
> [body]
> [blanc line]
> From (E-Mail Removed) Wed Mar 12 19:50:11 2008 [headers]
> [blanc line]
> [body]
> [blanc line]
> From (E-Mail 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 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
 
Reply With Quote
 
 
 
 
ccc31807
Guest
Posts: n/a
 
      03-13-2008
On Mar 13, 4:41 am, Bart Van der Donck <(E-Mail Removed)> 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 (E-Mail Removed) Wed Mar 12 19:14:17 2008
> [headers]
> [blanc line]
> [body]
> [blanc line]
> From (E-Mail Removed) Wed Mar 12 19:50:11 2008
> [headers]
> [blanc line]
> [body]
> [blanc line]
> From (E-Mail 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 Removed)" itself.
>
> Thanks,
>
> --
> Bart


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

CC
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
java String split() does not work for delimiter "|" ? chunji08@gmail.com Java 18 08-11-2013 03:42 PM
split problem if the delimiter is inside the text limiter rewonka Python 10 03-19-2009 03:24 PM
multi split function taking delimiter list martinskou@gmail.com Python 9 11-16-2006 09:33 PM
Re: String.Split with multi character delimiter Kevin Spencer ASP .Net 5 01-21-2004 05:31 PM
Delimiter Split Mark Fox ASP .Net 2 08-11-2003 07:19 AM



Advertisments