On Thu, Sep 23, 2010 at 2:44 PM, Rudolf O. Durrer <[email protected]>wrote:
> > Am 23.09.2010 um 22.27 schrieb [email protected]: > > > On 2010-09-23 13:37 , Rudolf O. Durrer wrote: >> >>> In the Finder, the information window of an ".emlx" (email) file >>> displays additional infos about the email itself, mainly when it was >>> send, the name the sender and the one of the adressee. This information >>> is far better than the name of the email file itself, which is just a >>> number. >>> >> > >> >>> Does anybody know a way to extract this information by means of an >>> applescript? >>> >> >> yeah, the files are basically: >> >> line 1: message length >> line 2 through length from line 1: message content >> everything else: a plist you can ignore >> >> what you seem to want is trivially formatted in the headers of the message >> (so you can ignore parsing the MIME formatted content); AppleScript can do >> this crudely by reading the file line by line and parsing the header fields; >> would be a bit easier as a shell script, or with a scripting language that >> has a library for parsing MIME messages >> > > Thanks your anser, steve, but I have to admit: I did not understand that. > How does Applescript read the file line by line in the Finder? > What I'm looking for is an applescript, which I can trigger (by means of a > Quickeys shortcut). This script would read (in the Finder) this information, > which would then in turn allow me to change the name of the email file > appropriately. > Oh, maybe I have to add, that I do move these email files first out of > their respective mbox folders to otgher locations... > > _______________________________________________ > MacOSX-talk mailing list > [email protected] > http://www.omnigroup.com/mailman/listinfo/macosx-talk > Exactly - the files are actually text files that are e-mail messages in RFC-822 format. You want to look for the headers that are "From:" "To:" and "Sent:" and maybe others (if it's a list mail such as this one, use "Delivered to:" instead of "To:" RFC-822 headers always begin the line. You can write a script that parses the file line by line and looks for the desired headers, and gets the data that follows the ":" Not all messages have all headers. "To:" is required. Others may or may not be depending on the servers the message has traversed. A simple look at 2 or 3 .emlx files will tell you what to look for... hope it helps...
_______________________________________________ MacOSX-talk mailing list [email protected] http://www.omnigroup.com/mailman/listinfo/macosx-talk
