How to get email addresses out of a sent mail folder?
June 6, 2006 4:05 AM
Subscribe
How do I extract the email addresses from a folder of sent mail sitting on an IMAP server, so that they can be put into a mailing list?
A colleague has sent individual emails to about two thousand people about an event that they have applied to attend. Those sent emails are held in five folders on an IMAP server.
I've just found out that my colleague has done it the (very) hard way. I'd like to help them out before they have to send the next email, by getting all of the individual email addresses out of those folders and into a Thunderbird mailing group (or one for each folder), so the update can be sent to everyone at the same time.
If I can get the addresses into a csv file, I can get them into Thunderbird. Any suggestions for a quick way of getting those addresses from that IMAP folder and into a csv file? I'm not afraid to go into a shell and do some commandline magic (OS X, or Cygwin on Windows), but I have no idea which incantation to use, and would really appreciate the help.
Thank you.
posted by reynir to computers & internet (11 comments total)
grep "^To: " * > emails.txt
Run that in each folder. It should pull the To: lines out of each email file, and store them in emails.txt. Then you can search&replace on emails.txt to get rid of all the "to:" and change the carriage returns to commas.
You could do it more elegantly with awk or perl, but if it's only a few thousand emails, and you only need to run it once, grep's yer buddy.
posted by ParsonWreck at 6:22 AM on June 6, 2006