|
|
One-script version with full body text
This is a one-script version of wfolta's "Cleaner but two-script version"... plus I added the To: field, and made a few changes to grab all of the body text. Not that this script MUST be named mailexport.pl (unless you change it in the source code).
#!/usr/bin/perl
if ($ARGV[1] == 2) {
$mail_dir = $ARGV[0] ;
$date = "???" ;
$subject = "???" ;
$from = "???" ;
$to = "???" ;
while () {
$body = '';
push (@message, );
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_dirt$datet$fromt$tot$subjectt", $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'") ;
}
To run it type (same as earlier post):
find ~/Library/Mail/Mailboxes/ -name mbox -exec ./mailexport.pl
'{}' ';' > tab-delimited-list
Corrected
We need a hint on how to post source code without it getting munged :-/
Entourage X
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:
One-script version with full body text
Does this script run with Jaguar?
One-script version with full body text
These scripts should work with Jaguar. Note that the find command assumes the mailboxes are in Library, which I believe changed from early versions of Mail that had them in Mailboxes directly in your home directory. (At least I had a Mailboxes directory in my home directory, which I think was a result of that.)
How would you run this on a specific mailbox?
How would you run this on a specific mailbox? I'm tying to run it on a mailbox:
One-script version with full body text
hi there, |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.15 seconds |
|