Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Splitting email inbox text into separate messages

by Vautrin (Hermit)
on Mar 12, 2004 at 15:59 UTC ( #336177=note: print w/replies, xml ) Need Help??


in reply to Splitting email inbox text into separate messages

You do not mention what format you are trying to deal with. Are you trying to read directly from a Unix mail spool? Are you trying to read a file in unix mbox format? Are you an Emacs user trying to read the Babyl formatted files produced by Rmail? Or, perhaps, is it one message per file with an index, and you need to parse the index and get rid of the headers? Or, is this for Outlook (Express) on a Windows system, using a completely different beast?

I can't tell you how to parse all of those formats off the top of my head. I can tell you that Abigail's suggestion of splitting on From: headers will work if you're using mbox format (and I think Babyl), however it will fail if someone includes an e-mail to you with the string "From:" at the beginning of a line. (Which probably isn't a big concern).

However, the key to all of this is the format. If you know what format the program you are trying to read from is using, you can look up the specifications online. There's probably also a module on CPAN available to parse it so you don't have to code. (And that module will possibly even handle things like indexes.)


Want to support the EFF and FSF by buying cool stuff? Click here.
  • Comment on Re: Splitting email inbox text into separate messages

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://336177]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2022-05-18 14:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (71 votes). Check out past polls.

    Notices?