Extract All Senders From Apple Mail

Ahmed Musaad
Ahmed Musaad
Extract All Senders From Apple Mail

I was trying to do some cleaning on my Mail app earlier today and realized having a list of all the senders in my inbox would be helpful in creating groups and blocklists which I can later use in my Smart Mailboxes. So, how complicated could such a small task be? Well, not that complicated.

I did some quick Google searches and tried a couple of solutions that didn't really work. I spent a few minutes wondering why isn't this an option in Gmail? Sounds like a pretty decent feature to me. Anyhow, after like 20 minutes of digging into various Stack Overflow answers, I found this command which did the trick for me:

sqlite3 -csv ~/Library/Mail/V8/MailData/Envelope\ Index 'SELECT comment, address FROM addresses;' > ~/Desktop/allAddresses.csv

An important thing to keep in mind is that V8 is dependent on your OS and Mail app version so in your case it might be V7 or any other variable, check the folder using commands on your terminal or browse to it using Finder.

That's all, hope you find this useful someday but in case you use another email client that does this a neater way, then ignore this entire post.

Great! Next, complete checkout for full access to Ahmed Musaad
Welcome back! You've successfully signed in
You've successfully subscribed to Ahmed Musaad
Success! Your account is fully activated, you now have access to all content
Success! Your billing info has been updated
Your billing was not updated