During my fun with Mail where it ballooned a mailbox to 25 GB I tried to export the emails. This failed to solve the problem. But sometimes exporting is a valid troubleshooting method. Mail offers different methods for exporting. Mail being Mail has always had problems with pesky details like counting. So it's not a surprise that each export method has slightly different results.
Today I'm going to look at three methods of exporting data out of Mail:
- Export the emails to mbox.
- Make a copy of the emails.
- Drag the emails to the Finder.
There is a fourth method using AppleScript which will need it's own article.
Before starting I note the number of emails in the mailbox. I'm going to use a medium sized one:

Export the emails to mbox
After selecting the mailbox and showing the context menu I can export the mailbox to the mbox format.
Even though it looks like the export is done immediately the "partial" in the name of the mailbox means that Mail is still writing emails:
Only when the partial is gone then the mailbox has finished writing:

Benefits:
- relatively fast
- only one file for the complete mailbox
- mbox is a universal format which - in theory - can be read by any email client
- no problems with file names
Drawbacks:
- no progress
- only works for mailboxes that are smaller than 2 GB!!!
If a mailbox is larger than 2 GB the export simply stops. No error message. Larger mailboxes need to be divided into smaller mailboxes.
Make a copy of the emails
The emails are single files on the hard disk. With a tiny bit of searching it's possible to locate the mailbox. Then I can make a copy of the data and put the folder somewhere.
The Mail folder is at user/username/Library/Mail/Vx where x is a number:
But where is my mailbox? As usual Find Any File from Thomas Tempelmann to the rescue. I need a folder (Kind is Folder) whose name starts with ablage (Name begins with ablage):

The first folder is what I need:

And now I can make a copy of the folder:
Benefits:
- fast
- shows a progress bar
- can easily be used for huge mailboxes
- no problems with file names
Drawbacks:
- one file per email
- can't be used for other email clients because the attachments are separate from the emails
Of course, Mail Archiver can import these folders directly.
Drag the emails to the Finder
The last method for today is to select emails in Mail and drag them to the Finder:

As usual there was no progress. I thought it hadn't worked after 1-2 minutes and did the drag-and-drop again which made a big mess on my desktop after a while:

When dragging files to the desktop there is one problem: the Finder allows only files with a length of 255 characters. If you think that 255 characters are enough then let me tell you that users and marketers are very very inventive. There is an additional problem with counting the characters. Some characters have 2 forms. An accented character can be written as one character like é. The Finder uses the second form where the character is written as ´e. So the max length of a file can be shorter than the 255 characters.
Instead of truncating the subject the drag silently fails. Both the mbox and the copy method don't have this problem because the files have different names.
Benefits:
- relatively fast
- can be imported into some email clients
Drawbacks:
- no progress
- one file per email
- no email if subject too long
The result - importing into Mail Archiver
Mail is super strict. Mail Archiver is not because it needs to import data from different types of data. Therefore, I imported the 3 sets of emails into Mail Archiver. The result is odd....
Drag: 3416 Mbox: 3416 Copy: 3420
All three results are different from the 3417 which Mail has as number of emails. I made 2 emails with a subject larger than 255 characters. I made a simple comparison in Excel between the 3 data sets with VLookup:
| copy | drag | mbox |
| <0100018259d6accd-976250cd-dd19-47c1-9229-e7179dd11d85-000000@email.amazonses.com> | not exported | not exported |
| <CAMWp=Z_Wh4p7h_rsDiP88jPc5Y9iGUgubezi2+_og--xSe4nSw@mail.gmail.com> | exported | not exported |
| <0> | not exported | not exported |
| <[email protected]> | exported | not exported |
| <[email protected]> | not exported | exported |
| <[email protected]> | not exported | exported |
Probably the first email was misfiled because it's a customer email. I need to have a look at the email with the message id of <0> because Mail Archiver should calculate a message id if there is no message id. The Gmail email is a normal email as is the immowelt one. The 2 beatrixwillius emails are the emails with the large subjects.
Verdict
I would not try to do a drag of emails to the desktop again. The copy is the easiest one to create, but the result can only be imported into Mail and Mail Archiver. The mbox file is the most generic result. But it's odd that some emails are missing.