Read the rest of the article for the script and find syntax...
Create this script, name it (mailexport.pl was used in this exmaple), make it executable (chmod 755 mailexport.pl), and keep it in the directory from which you'll run the find command:
#!/usr/bin/perlNote: The "open(Mail..." line has been split into two rows for readability; replace the line break with one space character.
$full_dir = $ARGV[0] ;
($mail_dir = $full_dir) =~ s|^.+?//|| ;
$mail_dir =~ s|\.mbox/mbox|| ;
$mail_dir =~ s|/| : |g ;
$full_dir =~ s/ /\\ /g ;
open(MAIL, "cat $full_dir | formail -e -s formail -X Subject:
-X From: -X Date: -a Subject: -a From: -a Date: |") ;
$i = 0 ;
while (<MAIL>)
{
if (/^Date: (.+)/)
{ chomp ($date = $1) ; }
if (/^Subject: (.+)/)
{ chomp ($subject = $1) ; }
if (/^From: (.+)/)
{ chomp ($from = $1) ; }
if (++$i == 3)
{
print ("$mail_dir\t$from\t$subject\t$date\n") ;
$i = 0 ;
}
}
close(MAIL) ;
Once you've prepared the script, you can export the chosen fields from all of your mailboxes by typing:
find ~/Library/Mail/Mailboxes/ -name mbox -exec ./mailexport.pl \Remember to execute the find from the directory containing the script, and change "mailexport.pl" to match whatever you named the script.
'{}' ';' > tab-delimited-list

