Email recipes
Recipes for email accounts managed with the macOS Mail application via the IMAP protocol. Thank you to people who answered with pointers to my question on the fediverse.
Exporting old emails to free up email quota
The solution I landed on is not as elegant as I hoped, but it worked.
- Create a mailbox/label for all messages matching your idea of an old email.
- Export this mailbox from the email provider’s interface, not from Mail.app.
Here’s the backstory.
How Mail.app can export emails
Mail.app has the Mailbox > Export mailbox… function that produces one big .MBOX file for an inbox. In the MBOX format, all emails and their attachments are concatenated in one big file.
This export function, presumably designed for small sets of emails that are processed instantaneously, doesn’t have a progress indicator. Exporting thousands of emails may take several hours, and you’ll know it’s finished when the exported .mbox
file stops increasing in size and its parent directory loses the .partial
in its name.
After a few attempts, I found this function to be unusable for a multi-gigabyte archive.
You can also drag-and-drop a bunch of emails from Mail.app to the Finder to produce an individual .EML file for each message. Exporting thousands of emails by drag-and-drop felt somewhat fragile, so I didn’t pursue it.
Finally, the ~/Library/Mail
folder theoretically holds individual emails in the .EMLX format. Some of these files have the .partial.emlx
suffix, meaning their attachments are not contained therein. In Mail > Settings… > Accounts, you can configure Mail.app to download all attachments for a particular email account, which would (again theoretically) make the .partial
emails complete. The vibes were off on this solution, so I haven’t pursued it either.
Step 1: create a Smart Mailbox to filter for old emails
To find emails prior to 2018, I made a Smart Mailbox with these criteria:
- Account is the target account
- Date received, is before the date, 01.01.2018
- Include messages from Sent
These criteria identified about 70,000 emails. Exporting the Smart Mailbox with Mailbox > Export mailbox… doesn’t work: it produces an empty .mbox
file. Apparently a well-known issue with Mail.app.
Step 2: move matched emails to a physical mailbox
I created a new mailbox called Old emails in the target account. This being a Google account, the operation resulted in a new Old emails label in the Gmail interface.
I grabbed all emails from the Smart Inbox with ⌘A and dragged them to this new mailbox, then checked in the Gmail interface for all 70,000 emails to have received the label. (It takes a while at this volume.)
For Google accounts specifically, you could also label these old emails from the Gmail interface by searching for before:2018-01-01 and applying the label to the matched emails, but the Mail.app route should work regardless of email provider.
After the process finished, I tried to export the Old emails mailbox with Mailbox > Export mailbox…, but noticed it got stock when the .mbox
file reached 2.16 GB. Apparently another well-known issue with Mail.app.
Step 3: Export an .mbox
for the label with Google Takeout
The Google Takeout interface allows you to configure which inboxes / labels to export. Select just the Old emails label and you’ll receive an email when you can download the .mbox
file. (Hopefully other email providers have comparable export features.)