[REBOL] Re: E-mail header info strip-off
From: philb:upnaway at: 10-Jun-2001 11:09
Yeah looked at the source for import-email & parse-header a few months back.
Amazing how so much is accomplished in so few lines of code.
Dont you just love Rebol :-)
> From: Geza Lakner
> > I would like to write a visual borwser for
> > e-mail messages saved in a single text file.
> > (Actually, first of all I would like to
> > browse my selected, saved messages
> > from this list :-) )
> > My question is, does incidentally anybody
> > have a parse rule that would strip-off all
> > the junk from the file (i.e. repeating
> > "Received" path listings), put the meaningful
> > header fields and the message body in a
> > structured REBOL block which can be traversed easily.
From: "GS Jones"
> Hi, Geza,
> This is a tough one!!!!!
> First, 'message is an email message that includes
> all the great headers that you dislike. ;-)
> Now for the magic that I slaved *all* morning over:
> my-email-object: import-email message
> I'm glad THAT project is over. REBOL already
> thought of this one and they did it just for you!
>From Phil B
> Hi Scott,
> That will not work for multiple messages in a single
> text file.
> Though I should think it would be easy to split the
> single text file into individual text files. Then load
> up the directory read through the files one at a
> time and use import-email message.
> If this is the route you go down then you might be
> interested in an email client I am working on. It
> expects all the seperate emails to be in seperate files
> inside a directory.
Hi, Phil and Geza,
Thank you, Phil, for making that point explicitly clear that the 'import-email
function is for a single message. I guess in my rush to be humorous (don't
worry, no one else thinks I am funny), I forgot to be explicitly clear.
In the interim, I thought of several things more that I should have mentioned to
Geza, including your project. There are several submitted projects that also
address email management, and several have some very clever tricks. You may
wish to browse the archives.
If you want to support headers that are not in the standard email headers, you
can do a little bit of extra writing in order to snag those extra headers. Look
at the source for import-email (source import-email). It uses another nifty
function that I only noticed earlier today (or had forgotten about):
parse-header. You can craft your own headers to be saved, and pass this object
into the parse-header function. Neat!!
Sorry for being glib in my earlier post.