Extract all e-mails stored in Apple Mail

We needed an app or script today for a client that could help us extract all e-mail adresses that are stored in Apple Mail. After some googling we found these three simple commands on the Don't stop the Signal blog.

cd ~/Library/Mail
find . -name *.emlx -print0 | xargs -0 perl -wne'while(/[\w\.]+@[\w\.]+/g){print "$&\n"}' * > ~/Desktop/extracted_emails.txt
sort ~/Desktop/extracted_emails.txt | uniq > ~/Desktop/sorted_emails.txt

Looks interesting?

Are you looking for someone who can assist you with your web project?
Someone with know-how who can handle your project completely in-house?

Contact Me!