Mail storage structure and rules

Hello,


I am trying to understand how emails and attachments are stored on my Mac. I know they reside in Librairy/Mail/ but what I would like to understand is how attachments are separated from their emails. I see a few cases:

  • The email does not have an attachment and is stored as emlx
  • The email has attachment and is stored as in a partial.emlx format. Two possibilities for the attachments:
    • They are stored as emlxpart in the same folder as the email
    • They are stored in ../Attachments/EmailNumber/ under their own number and in their own format (.pdf, .doc etc. but not in emlxpart format)


Questions:

  • Are there other possibilities? I saw for instance a movie of 50Mb which was not stored under an attachment number bur direction under ../Attachments/ and within the email this attachment was refered as an "Remote-Attachment-URL" with a link to icloud.
  • Are there rules regarding whether an attachment is saved in the same folder as the email in a emlxpart format? What triggers an attachment to be stored in its native format vs in emlxpart?
  • Is there a reason some attachments have floating numbers (ex. 1.2, 2.4) when others have integers?


Thank you for your help.


Best regards,


Thomas

Posted on Sep 25, 2023 10:27 PM

Reply

Similar questions

16 replies

Oct 11, 2023 10:10 PM in response to etresoft

I work in forensics and am trying to consolidate apple mail library in eml format and would like to make sure I do not miss any attachments. I should have stated my purporse more clearly but did not find comments encouraging as I had hoped. I manage to find most of the information I needed by poking around and performing some test.


For anyone else interested here's what I have found empirically:

  • If there are no attachments, the format is emlx, no problem
  • Two possibilities if there are attachments:
    • Attachments are either stored within the partial.emlx directly and/or in the Attachment folder of the same mail name in the format "x.y": any "embedded" attachment in an partial.eml seems to be stored in a float folder name.
    • Attachments which are not embedded in the partial.emlx are stored in the same "Messages" folder inthe form of an emlxpart. These attachments seem to also be stored in the Attachment folder associate to the Messages folder in integer named folders.

My last task is now to determine whether the elements stored in the Attachment folders are necessary for the emails and if the Message folder is stand-alone. I've performed a few test and removed the Attachment folder before converting them to EML and the resulting emails have the necessary attachments, but my sample was small.


Best regards,


Thomas

Sep 27, 2023 5:14 AM in response to TCambazard

TCambazard wrote:

I'm trying to consolidate data from an mac to a eml format, and yes I know there are tools out there but I would need some understanding of the process.

Poking around in the Library folder is not the way to do that. Instead of consolidating anything, all you will do is corrupt your Mail database.


I don't even know what you mean by "consolidate". Normally the way it works is you keep your mail in an online e-mail service like iCloud, Microsoft Exchange, or Gmail. Then you just use your Mail. If you are trying to do something else, then it would be best to start by describing exactly what you are trying to do. If all you want to do is corrupt your e-mail database, then keep going. If you want, I can recommend some 3rd party software that will corrupt your data much faster than you could ever do manually.

Sep 27, 2023 7:39 AM in response to TCambazard

TCambazard wrote:

I'm trying to consolidate data from an mac to a eml format, and yes I know there are tools out there but I would need some understanding of the process.


“Corrupting your mail database” would be the shorter description of that goal.


EML format is a Microsoft-developed message format, and used for migrating messages. macOS Mail app supports exporting to that message format, but does not use that format internally.


EML is ill-suited for directly accessing messages, as the EML files need to be parsed and their contents extracted to separate files before, for instance, the images and other file attachments can then be accessed. Or in-memory parsers need be written for ~everything, of course.


If you want to migrate to some other mail client such as Microsoft Outlook (and with Outlook, then probably also from macOS to Microsoft Windows), then select the appropriate tools and migrate to that. EML handles message migrations well.


Sep 27, 2023 8:13 AM in response to TCambazard

TCambazard wrote:

I'm trying to consolidate data from an mac to a eml format, and yes I know there are tools out there but I would need some understanding of the process.

To clarify here, I'm sincerely asking you to describe what you are trying to do. Please be specific. "Consolidate" is not specific. What are you trying to do?


I can tell you what I do. I only keep the past couple of years of e-mail messages on the servers. Every couple of years, I export my old message to "On my Mac" mailboxes, organized by year. Then, when I want to setup a new computer, I have to remember to manually export all of those "On my Mac" mailboxes as "mbox" files and then re-import them on the new computer. When I setup a new computer, I do it with iCloud. Migration or Time Machine is only appropriate when you are moving content and the old system will be put out of service or completely reconfigured. I tend to keep my old computers around for testing or backwards compatibility. If I copy my data from those old computers, it will subtly corrupt lots of low-level things. So I let iCloud do what it does best and manually copy the rest. I do this maybe once every 3 years or so, so it's not a burden.


The internal format of the Apple Mail database or individual files may be technically interesting, but not really important. You can export individual messages to elmx files and use the Finder as a database for organization. This way, they will act as document files that can be opened with mail. But their internal structure is an implementation detail that is private to Apple. The same is true of any document format from Apple or any other developer.

Oct 12, 2023 6:01 AM in response to TCambazard

TCambazard wrote:

Export from where? I have an iOS (an iMac)'s content, with the tree structure but I am not on the iMac itself with an access to the Mail app and its content. Is there a way to load in the Mail app (or any other Apple app) the content of the Librairy/Mail folder and then export in EML the found emails?


So you have a wad of mail-related data from some other iMac running macOS, and want to unpack that on something else; on an iPhone running iOS or an iPad and iPadOS, or on Linux, or BSD, or (how did I forget?) Windows, or whatever else?


How big is your app development budget, because it’d undoubtedly going to be far cheaper to rent a Mac for a week or month or so or whatever is on offer, and unpack and export there than to reverse-engineer macOS mail somewhere else. MacStadium, Amazon EC2, and some other vendors rent macOS access, for instance.


Chances of finding an existing iOS or iPadOS app that will unpack macOS mail backup on iPhone or iPad is approximately zilch, of course.

Oct 12, 2023 6:25 AM in response to MrHoffman

I have an image of a Mac, that is its entire file system. I have Windows, iOS and Linux machines on which to run whatever I need but I need to transform the content of the user/librairy/mail content from its current proprietary format (emlxpart, partialemlx etc.) to EML standard, independently from any OS. There are tools which perform this but I need to be certain that they do not miss any attachment, hence my questions to be able to check that no file is left behind

Oct 12, 2023 7:46 AM in response to TCambazard

TCambazard wrote:

Export from where? I have an iOS (an iMac)'s content, with the tree structure but I am not on the iMac itself with an access to the Mail app and its content. Is there a way to load in the Mail app (or any other Apple app) the content of the Librairy/Mail folder and then export in EML the found emails?

OK. What? Originally, you said, "I am trying to understand how emails and attachments are stored on my Mac." That's a pretty unambiguous statement - "my Mac". That implies you have a Mac.


Now you are referring to something that is "an iOS (an iMac)'s content"? You have "an image of a Mac", not an actual Mac. You have "Windows, iOS and Linux machines".


It sounds like you have left a whole lot out of this. What is "an image"? Where did you get it? Are these even your e-mails?

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Mail storage structure and rules

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.