Apple Mail Statistics from Terminal I have a small question regarding Apple Mail App. I would like to use the Terminal in order to extract information regarding my e-mail habits. In particular, I would like to have a list of the day/time when an email was sent from my Mac using the Mail App even if that sent email was deleted. Thank you!
Mail keeps a lot of metadata in a SQLite database stored in ~/Library/Mail/V6/MailData/Envelope Index (the V6 changes from time to time with major macOS releases). It's not officially documented and a quick web search didn't yield a lot of results (https://javarants.com/build-your-own-mail-analyzer-for-mac-mail-app-747143e94ccc, https://labs.wordtothewise.com/mailapp/). But you should be able to reverse-engineer the schema using either sqlite3 or any of the GUI-based SQLite tools (just make sure to use a copy of the database to play with).