When sending an email to someone in Apple Mail it remembers their address, so if you try and send another email to them it'll prompt you with it - even if you haven't added them to the address book.

Is there any way of exporting those remembered addresses, or saving them to the address book?


In Mail, go to Window -> Previous Recipients. You can then add them to your Address Book. If you want to export the list to a file, you can do so in the Terminal by directly accessing the sqlite database with sqlite3. Excerpt from link (formatting mine):

This turns out to be more complicated than I had hoped, but it is possible.

The Apple mail program uses a database program available in Unix called “sqlite3.” The executable is in /usr/bin. For information about this program, type “man sqlite3” in a terminal window. Also, there is information on the web, at www.sqlite.org. A friend whose day job is in database administration helped me work this out.

First, go the proper directory in a terminal window:

cd ~/Library/Application Support/AddressBook

The file of interest is MailRecents-v4abcdmr.

Note that the file command describes this as:

$ file MailRecents-v4abcdmr
MailRecents-v4.abcdmr: SQLite database (Version 3)

$ sqlite3 MailRecents-v4.abcdmr
SQLite version 3.4.0
Enter ".help" for instructions

Let’s see the headers:

sqlite> .headers ON

Now, let’s get some information about what’s in this database file:

sqlite> select * from SQLITE_MASTER; /* don’t forget the semicolon */
/* lots of output */

The table ZABCDMAILRECENT is of interest to us. Note that the last 3 columns are called ZLASTNAME, ZFIRSTNAME, and ZEMAIL. We want these from the table, in columns, in filename.txt.

sqlite> .mode columns ZABCDMAILRECENT
sqlite> .width 15 15 36 /* make sure the columns are wide enough */
sqlite> .output filename.txt /* note: no ‘;’ */
sqlite> .exit

Done. The email names and addresses are now in filename.txt, one per line.

Maybe, someday, someone at Apple will add this capability to mail.


If using OS X 10.10 use the following code as the location of the previous recipients file changed. I did some digging and this worked for me (the following is all one line):

sqlite3 -csv ~/Library/Containers/com.apple.corerecents.recentsd/Data/Library/Recents/Recents 'select display_name, address from contacts where kind like "email";'>~/Desktop/recent.csv

This new 'Recents' file contains ALL recent contacts including, FaceTime and iMessage recipients so an additional filter was added to only export e-mail contacts.

  • Wow! This works perfectly! Thank you so much for that! – CodeBrauer Nov 7 '18 at 15:17

To export to a CSV file:

Run as one line:

sqlite3 -csv ~/Library/Application\ Support/AddressBook/MailRecents-v4.abcdmr 'select ZLASTNAME, ZFIRSTNAME, ZEMAIL from ZABCDMAILRECENT;'

To export to file "recent.csv":

sqlite3 -csv ~/Library/Application\ Support/AddressBook/MailRecents-v4.abcdmr 'select ZLASTNAME, ZFIRSTNAME, ZEMAIL from ZABCDMAILRECENT;'>recent.csv


This is a stupid, but simple way to do it.

Mark all mails, choose print - but change to save to PDF, then export to Word, then export to TXT file format and start to filter the file with Text Wrangler.

Easy but stupid ;)

  • Can you please eloborate how to filter the file with text wrangler. – Naveed Abbas Nov 20 '16 at 15:09

I don't know if this was if you were looking for, but google brought me here when I was looking for it, so you can export all mail addresses on your Mail App like this:

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

You might have to grant privileges to the terminal like: https://apple.stackexchange.com/questions/339626/error-unable-to-open-database-in-macos-mojave

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.