![]() |
|
FastMail Forum All posts relating to FastMail.FM should go here: suggestions, comments, requests for help, complaints, technical issues etc. |
![]() |
|
Thread Tools |
![]() |
#1 |
Essential Contributor
Join Date: Mar 2002
Location: Belgrade, RS
Posts: 307
|
Ruby script eml files -> unix mbox available
I've been playing with Ruby lately, so for the sake of practicing I wrote a script that converts multiple eml files into a single unix mailbox file (as discussed here). I know it is not yet a widely used platform, but I've placed the script and a description of usage here in case someone needs it.
Script is tested on win and cygwin. Mailbox file tested on win (The Bat) only. I would appreciate if someone running a mail client on other platforms could confirm that it works (or not ![]() Edit: Updated URL Last edited by ivec : 19 Feb 2003 at 05:23 AM. |
![]() |
![]() |
![]() |
#2 |
Master of the @
Join Date: May 2002
Location: Eugene
Posts: 1,975
|
Ruby, wow.
![]() Your script works on Mac OS X (10.2.4), but the mbox file it generated has the similar 'From ' header incompatibility as using "formail -a Date: ..." (explained in the other thread) so it's unreadable by the standard command line "mail" program. Other programs will be more forgiving of Sample: Code:
From No Body <nobody@hotmail.com>^M Sun, 07 Jul 2002 19:18:45 -0700 Also looks like you need to '>'-quote lines starting with 'From' in the message body. Lastly, you might want to name your script eml2mbox (or eml2unix) to lessen chance of mistaking its output with the mbx file format used by the UW IMAP server; see Mailbox Format Characteristics. Thanks for the contribution. |
![]() |
![]() |
![]() |
#3 | |
Ultimate Contributor
Join Date: Sep 2001
Location: Australia
Posts: 11,501
|
Quote:
Code:
if line =~ /^From\s.*@/ line = line.sub(/From/, '>From') end |
|
![]() |
![]() |
![]() |
#4 | |
Essential Contributor
Join Date: Mar 2002
Location: Belgrade, RS
Posts: 307
|
Thanks for your feedback sjk. I've updated a new version of the script which should fix the CR and From problems you outlined. Please note that the url has changed due to the script name change. Please let me know if this solved the CR problem on Mac OS X
Quote:
![]() |
|
![]() |
![]() |
![]() |
#5 | |
Essential Contributor
Join Date: Mar 2002
Location: Belgrade, RS
Posts: 307
|
Quote:
I could add a switch to control this if there is a mail client out there that doesn't strip '>' from '>From' if it doesn't have a '@' in that line when importing a mbox. |
|
![]() |
![]() |
![]() |
#6 | |
Master of the @
Join Date: May 2002
Location: Eugene
Posts: 1,975
|
Quote:
It's been many years since I've thought harder about '^From ' quoting issues so I'm not fresh on that topic. Now it's just one of those "know it when I see it" legacy mailer nits that still needs occasional manual intervention. Anyway, your script does the quoting of my sample messages that it missed before. The archive file still doesn't have message-separating 'From ' lines that mail, mutt, and other traditional Unix utilities will accept. Some looking like this are generated Code:
From ""@mail.example.com 1 Jul 2002 20:49:36 -0000 From Somebody <somebody@example.com> Wed, 24 Jul 2002 20:42:06 -1000 Code:
^From <word> ctime() [TZ] ![]() Looks like formail spits out a consistent style date/time string so it's surprised that's not ctime() format for compatibility. |
|
![]() |
![]() |