MacOS – Where does gmail/Apple Mail keep its messages

gmailmacosmail.app

I have several email accounts on a Mac.

With a simple IMAP account, the messages are in /Users/[user name]/Library/Mail/V[a number]/IMAP-[email adress]/INBOX.mbox/

However, Apple Mail seems to hide the messages away differently if you are using gmail. If I go to the same folder scheme — nothing there.

Ideas?


More specifically, I am looking for a way to find only the Sent messages. I have been able to locate an ALL messages folder at:

/Users/[user name]/Library/Mail/V3/IMAP-[email address]@imap.gmail.com/[Gmail].mbox/All Mail.mbox/

But how do I separate out the sent messages?

The Sent Mail.mbox directory only has a .plist file in it even though there are thousands of sent messages. Doing a file count on the All Mail.mbox makes clear that that is literally all the mail (sent, received, drafts, etc) Looking at the .emlx header it is not obvious what would differentiate one from the other.

Best Answer

The URL you state is by and large correct, but the details can differ based on your exact configuration. On my machine (which runs El Capitan, uses V3 in the mail path, and for a Gmail account where the IMAP Path Prefix is set to [Gmail]), the messages for the inbox are stored in the path you stated but messages for other standard folders are in the path MrWonderful suggested.

The easiest way I think is to send yourself an email with a unique string (ideally without spaces) as the subject) and to get creative on the command line.

find . -name '*emlx' | xargs grep 'UNIQUE_STRING' -ls

This finds all messages and subsequently searches them for the string, spitting out only the file names (with path) for the files containing that specific string.

Hope this helps you dig around the mail folder and find the information you're looking for.