How is mail stored on mac

On a Mac, mail is typically stored in the following locations:

  1. Mailbox files: When you create a new email account or import existing emails, Mail.app (the built-in email client on Mac) stores the emails in a series of files called mailbox files. These files are stored in the ~/Library/Mail/V2 folder, where ~/ represents your user directory (e.g., ~/Library/Mail/V2 would be ~/Library/Mail/V2 for the user "John Doe").
  2. Mailbox databases: Each mailbox file is associated with a mailbox database, which is a SQLite database that stores metadata about the emails, such as the sender, recipient, subject, and date. The mailbox databases are stored in the same ~/Library/Mail/V2 folder as the mailbox files.
  3. IMAP and POP3 accounts: If you have IMAP (Internet Message Access Protocol) or POP3 (Post Office Protocol version 3) accounts set up on your Mac, your emails are stored on the mail server and synced with your Mac. In this case, the emails are not stored locally on your Mac, but rather are accessed remotely through the mail server.

Here's a breakdown of the folder structure:

When you delete an email on your Mac, it is moved to the Trash mailbox, which is stored in the same ~/Library/Mail/V2 folder. If you empty the Trash, the emails are permanently deleted and cannot be recovered.

It's worth noting that if you have multiple email accounts set up on your Mac, each account will have its own set of mailbox files and mailbox databases stored in the ~/Library/Mail/V2 folder.