Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Corrected | 15 comments | Create New Account
Click here to return to the 'Corrected' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Corrected
Authored by: jima on Sep 03, '02 07:48:23AM

We need a hint on how to post source code without it getting munged :-/

#!/usr/bin/perl

if ($ARGV[1] == 2) {

$mail_dir = $ARGV[0] ;

$date = "???" ;
$subject = "???" ;
$from = "???" ;
$to = "???" ;

while (<STDIN>) {

$body = '';
push (@message, <STDIN>);
foreach (@message) {

if (/^From: (.+)$/) {
chomp ($from = $1);
}

elsif (/^Subject: (.+)$/) {
chomp ($subject = $1);
}

elsif (/^Date: (.+)$/) {
chomp ($date = $1);
}

elsif (/^To: (.+)$/) {
chomp ($to = $1);
}

else {
$body .= $_;
}

}

}

print ("$mail_dir\t$date\t$from\t$to\t$subject\t", $body, "\n") ;

} else {

$full_dir = $ARGV[0] ;
($mail_dir = $full_dir) =~ s|^.+?//|| ;
$mail_dir =~ s|\.mbox/mbox|| ;
$mail_dir =~ s|/| : |g ;
$full_dir =~ s/ /\\ /g ;

system("cat '$full_dir' | formail -e -k -X Subject: -X From: -X " .
"Date: -X To: -s ./mailexport.pl '$mail_dir' '2'") ;

}



[ Reply to This | # ]
Entourage X
Authored by: jima on Sep 03, '02 08:04:56AM

I noticed that if you drag a folder from the Entourage X Inbox to the Finder it saves it in a *.mbox format. So to make this work with Entourage, drag a folder from Entourage to the same Finder directory that the script is in (in this example the folder was called 'work' in Entourage, and in the Finder it appeared as 'work.mbox'). Next, use BBEdit (or ??) to change the line endings from Mac to Unix. Then in the Terminal from the directory that the script is in, type:

perl ./mailexport.pl work.mbox > tab-delimited-list

whoo-hoo! :)



[ Reply to This | # ]