Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

E-mail header info strip-off

 [1/15] from: gjones05::mail::orion::org at: 9-Jun-2001 10:43


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.
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! --Scott Jones

 [2/15] from: geza67:freestart:hu at: 9-Jun-2001 16:51


Dear REBOLers ! 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. Many thanx for your kind input, Cheers Geza Lakner MD

 [3/15] from: philb:upnaway at: 10-Jun-2001 0:03


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. Cheers Phil -- Origional Message -- 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.
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! --Scott Jones

 [4/15] from: gjones05:mail:orion at: 9-Jun-2001 11:59


> From: Geza Lakner > > I would like to write a visual borwser for
<<quoted lines omitted: 9>>
> > 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!!!!!
<<quoted lines omitted: 16>>
> 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. --Scott Jones

 [5/15] from: philb:upnaway at: 10-Jun-2001 11:09


Hi Scott, 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 :-) Cheers Phil
> From: Geza Lakner > > I would like to write a visual borwser for
<<quoted lines omitted: 9>>
> > 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!!!!!
<<quoted lines omitted: 16>>
> 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. --Scott Jones

 [6/15] from: ingo:2b1 at: 10-Jun-2001 9:40


Hi Geza, this here's a little mbox file parser I started hacking lately, all you'll have left to do is send the email to your personalized 'import-email ;-) I hope that helps a little ... REBOL [ Title: "MBox Handling" Date: 2001-07-05 Author: "Ingo Hohmann" Email: [ingo--2b1--de] File: %mbox.r Home: http://www.h-o-h.org/ Version: 0.0.1 ] mbox: context [ ;file: %/home/ingo/Mail/test.mbox chars: charset [ #"a" - #"z" #"A" - #"Z" ] email-chars: charset [ #"a" - #"z" #"A" - #"Z" #"0" - #"9" #"." #"-" #"_" #"+" #"%" ] digit: charset [ #"0" - #"9"] mail-index: copy [] index: func [ "creates an index of an mbox file" mbox-file [file!] "mbox file to parse" /local idx cnt blk ] [ either block? blk: select mail-index mbox-file [ clear blk ] [ append mail-index mbox-file append/only mail-index blk: make block! 100 ] save-index: func [][] idx: make block! 500 cnt: 0 email-start: none mbox-rule: [some email-rule to end email-end:] address-rule: [ some email-chars "@" some email-chars ] ; could be _much_ better ... email-rule: [ email-end: ;(if not none? email-start [print [ ">" copy/part email-start find email-start newline]]) "From " copy frm address-rule " " 3 chars " " 3 chars " " 2 digit " " 2 digit ":" 2 digit ":" 2 digit " " 4 digit newline ;(?? frm) ( if not none? email-start [ cnt: cnt + 1 header: import-email header append/only idx reduce [cnt header/from header/subject header/date index? email-start index? email-end] append/only blk reduce [index? email-start index? email-end] ] email-start: email-end ) copy header [ thru "^/^/" ] to "^/From " skip | to "^/From " skip ] probe parse/all read mbox-file mbox-rule ; add the last mail header: import-email header append/only idx reduce [cnt header/from header/subject header/date index? email-start index? email-end] append/only blk reduce [index? email-start index? email-end] idx ] get-mail: func [ file [file!] "mail file" pos [integer!] "position in the file" ] [ if not find mail-index file [ index file ] idx: pick select mail-index file pos ;idx: pick idx pos probe idx f: open/direct/read file skip f (idx/1 - 1) mail: copy/part f (idx/2 - idx/1) close f mail ] ]

 [7/15] from: gjones05:mail:orion at: 10-Jun-2001 5:41


From: "Ingo Hohmann"
> this here's a little mbox file parser I started hacking lately, > all you'll have left to do is send the email to your personalized > 'import-email ;-) > > I hope that helps a little ...
...
> Home: http://www.h-o-h.org/
... Hi, Ingo, In browsing your site, I see that you have several nifty scripts. I was just wondering yesterday whether anyone had ventured to making a web browser in REBOL/View, and, like magic, I see you have one. I like your rendered space craft; it reminds me of an updated version of Darth's fighter craft. With what application did you render this? --Scott Jones

 [8/15] from: petr:krenzelok:trz:cz at: 10-Jun-2001 13:23


----- Original Message ----- From: "Ingo Hohmann" <[ingo--2b1--de]> To: <[rebol-list--rebol--com]> Sent: Sunday, June 10, 2001 9:40 AM Subject: [REBOL] Re: E-mail header info strip-off
> Hi Geza, > > this here's a little mbox file parser I started hacking lately, > all you'll have left to do is send the email to your personalized > 'import-email ;-)
I am just curious - has anyone investigated NS mail format file + indexes? What do I really like about NS (and that's exactly the reason I still use NS) is - it's mail and news app. I like text form storage, as opposed to binary one of Outlook Express. Parsing NS mail inbox is not a problem, but the problem is - if it is possible and easy to use NS index files. If so, we could easily build NS mailer replacement, while still allowing to share the same mailbox between REBOL/View app, and NS itself ... -pekr-
> I hope that helps a little ... > REBOL [
<<quoted lines omitted: 10>>
> chars: charset [ #"a" - #"z" #"A" - #"Z" ] > email-chars: charset [ #"a" - #"z" #"A" - #"Z" #"0" - #"9" #"." #"-"
#"_" #"+" #"%" ]
> digit: charset [ #"0" - #"9"] > mail-index: copy []
<<quoted lines omitted: 15>>
> mbox-rule: [some email-rule to end email-end:] > address-rule: [ some email-chars "@" some email-chars ] ; could be
_much_ better ...
> email-rule: [ > email-end: ;(if not none? email-start [print [ ">" copy/part
email-start find email-start newline]])
> "From " copy frm address-rule " " 3 chars " " 3 chars " " 2 digit "
2 digit :" 2 digit ":" 2 digit " " 4 digit newline ;(?? frm)

 [9/15] from: gchiu:compkarori at: 10-Jun-2001 23:40


On Sun, 10 Jun 2001 05:41:11 -0500 "GS Jones" <[gjones05--mail--orion--org]> wrote:
> scripts. I was just > wondering yesterday whether anyone had ventured to making > a web browser in > REBOL/View, and, like magic, I see you have one.
There's also a pretty impressive browser at the FX5 site. -- Graham Chiu

 [10/15] from: g:santilli:tiscalinet:it at: 10-Jun-2001 11:56


Hello GS! On 09-Giu-01, you wrote: GJ> If you want to support headers that are not in the standard GJ> email headers, you can do a little bit of extra writing in IIRC, import-email DOES save any header, not only the ones in system/standard/email. Also, I don't know if import-email has been changed since last year, but if it didn't, I have some patches that allow to keep names as well as email addresses (e.g. mail/from is ["Gabriele Santilli" [g--santilli--tiscalinet--it]] instead of just [g--santilli--tiscalinet--it]) and to record headers that appear multiple times (such as the Received: headers). (It uses a non-recursive parse rule, too, and automatically decodes quoted-printable messages.) My patches were posted on this list a long time ago. I anyone needs them I can repost, or maybe put them online somewhere (didn't do that yet because that was a work in progress; you'll probably need to check that it doesn't break current REBOL versions). Regards, Gabriele. -- Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/

 [11/15] from: ingo:2b1 at: 10-Jun-2001 18:10


Hi Gabriele, I am interested in your patches ... in my own set I have not payed attention to things like Recieved:, so I might find something valuable to rip off in yours ;-) kind regards, Ingo Once upon a time Gabriele Santilli spoketh thus:

 [12/15] from: ingo:2b1 at: 10-Jun-2001 18:03


Hi Scott, I'm not a coding person, really, this shows at least at the speed that my scripts are worked on ... I'm sure Carl would've done the space craft in half the time in /View, but I just went ahead and used PovRay. kind regards, Ingo

 [13/15] from: geza67:freestart:hu at: 10-Jun-2001 21:40


Hi Scott !
>Now for the magic that I slaved *all* morning over: >my-email-object: import-email message
I am aware of this solution BUT don't use REBOL as a primary POP3 client ... i.e. I use Pegasus Mail, filter my mail into appropriate folders and export it to a text file. And here comes the problem with th processing of this messy file :-( THX, Geza

 [14/15] from: mbicanic:open:hr at: 11-Jun-2001 21:45


Hi Petr, PK> I am just curious - has anyone investigated NS mail format file + PK> indexes? What do I really like about NS (and that's exactly the reason I PK> still use NS) is - it's mail and news app. I like text form storage, as PK> opposed to binary one of Outlook Express. PK> Parsing NS mail inbox is not a problem, but the problem is - if it is PK> possible and easy to use NS index files. If so, we could easily build NS PK> mailer replacement, while still allowing to share the same mailbox PK> between REBOL/View app, and NS itself ... PK> -pekr- I don't know if this helps, but: AFAIK NS will create index file for when you start it and there is no index for mbox file in mail directory. In this way NS can import mbox from (eg.)Pine. So if you edit mbox from REBOL you need to "just" delete index file. I think that there is an update in NS menu that allow you to update mbox-es, and you don't need to restart it. PS I don't have NS at home to experiment, so try it on your risk... :) regards.mb

 [15/15] from: petr:krenzelok:trz:cz at: 11-Jun-2001 23:29


----- Original Message ----- From: "mb" <[mbicanic--open--hr]> To: <[rebol-list--rebol--com]> Sent: Monday, June 11, 2001 9:45 PM Subject: [REBOL] Re: E-mail header info strip-off
> Hi Petr, > > PK> I am just curious - has anyone investigated NS mail format file + > PK> indexes? What do I really like about NS (and that's exactly the reason
I
> PK> still use NS) is - it's mail and news app. I like text form storage,
as
> PK> opposed to binary one of Outlook Express. > > PK> Parsing NS mail inbox is not a problem, but the problem is - if it is > PK> possible and easy to use NS index files. If so, we could easily build
NS
> PK> mailer replacement, while still allowing to share the same mailbox > PK> between REBOL/View app, and NS itself ...
<<quoted lines omitted: 3>>
> index for mbox file in mail directory. In this way NS can import mbox from > (eg.)Pine. So if you edit mbox from REBOL you need to "just" delete index
file.
> I think that there is an update in NS menu that allow you to update
mbox-es,
> and you don't need to restart it.
Hi :-) not quite true though. It would really loose performance if it would not use index files :-) I should know - my inbox is of some 90 MB now :-). NS index files are called .snm or .smn? Don't know right now. What is also strange is method of message removal. Once you delete it, it is physically only copied to Trash folder, while it still remains part of e.g. inbox folder. - So deleting msgs just eats you even more free hd space, unless you pack mailbox ... -pekr-

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted