12/22/16
10:58 am

Forum Question: How to Remove Downloaded Email Attachments From Mail App In MacOS?

When an attachment is opened, the file is stored in a temporary folder under the email account’s inbox, in a convoluted naming scheme that references the attachment to the email. Although these files are supposed to be temporary, they stay behind on the drive and can occupy gigabytes of space. Given the complex folder structure used by the Mail app, there’s no easy way to navigate through all these folders and delete the attachments that are left behind.

Any ideas of how they can be deleted? Do any apps exist that can do this automatically for the user?

I suppose that as long as one uses an IMAP acct,, the email accounts could be removed from the system and their respective mBoxes deleted in their entirety, before adding the accounts again on the computer. But I’m not clear what else could be lost following this drastic method, which would also be time consuming in case multiple email accounts are used on the same computer.

Any suggestions would be appreciated.
—–
Phil Rodokanakis

Comments: 11 Responses to “How to Remove Downloaded Email Attachments From Mail App In MacOS?”

    12/22/16 @ 10:58 am

    For those that don’t know, the folder in question is:
    ~/Library/Containers/com.apple.mail/Data/Library/Mail Downloads

    When you try to open or view an attachment to an email message, this is where the attachment is saved so you can then open/view it. But it remains there afterward, which can be a problem as it takes up space. This will be more of a problem for some than others. I get tons of email, and my Mail Downloads folder contains items that date back to Feb 2015, but it is still only about 150MB in size, just a tiny fraction of my 1TB drive.

    If you choose to set your email accounts to not automatically download attachments, then it solves a lot of the problem. You can do this in Mail, Preferences, Accounts, Account Information, Download Attachments — set to none. Then just manually “save” the attachments you need to a specific location to bypass this Mail Downloads folder problem. This doesn’t work 100% of the time, as mail attachments are weird and vary in implementation depending on your email provider and the provider and app the sender was using. But it works for me to make this a non-problem.

    However, there is no harm in deleting the whole Mail Downloads folder every once in a while. It is really just a “cache” of files. You shouldn’t be relying on it to store files anyway, use “Save Attachment” for that. And it doesn’t delete the files from the actual email, just this local version that is meant for viewing.

    So if they presents a problem for you, which I guess it could if you receive a lot of attachments for work on a daily basis and preview them instead of saving them, then just put “~/Library/Containers/com.apple.mail/Data/Library/Mail Downloads” in your Finder sidebar or an alias to it somewhere so you can go there and clear it out when you want.

    Phil
    12/22/16 @ 2:36 pm

    Thanks for the quick reply. Frankly, I wasn’t aware of the Mail Downloads folder you point out (you’re right, the contents of this folder are measured in MB and can be easily deleted). But, apparently, that’s not the only folder where email attachments are stored. I find attachments left behind in the mBox of each email account that’s configured on the computer. For example, here’s the path to one Attachment folder. Continued

    Phil
    12/22/16 @ 2:41 pm

    “Users/UserAccount/Library/Mail/V4/525C512E-8A6F-40B0-8611-3AE9C1312A67/INBOX.mbox/972B6286-18C1-47BE-A1D1-049E163E5196/Data/3/7/2/Attachments.”
    And this sort of folder structure is repeated time and time again under the INBOX.mBox. I’m not sure what attachments get saved in the Downloads folder and what attachments get saved under the mBox folder, but what’s in the latter path, is very pernicious and hard to get rid of.

    12/22/16 @ 3:01 pm

    Phil: So what you are looking at there is your email database. Those aren’t really meant to be viewed as files. To work with the data in there, you should only use the Mail app. If you want to get rid of an attachment, find the message in Mail and then use Message, Remove Attachments. Or, just simply delete the email entirely if you don’t need it.
    You should also be able to use Mail, Preferences, Accounts, (select account), Account Information and set Download Attachments to “none” to avoid having attachments downloaded at all unless you need them. This functionality may vary depending on your email system and also the email app/system used by the sender (there are multiple ways to “attach” files to emails).

    Phil
    12/22/16 @ 3:24 pm

    Thanks, Gary. I’m familiar with the mBox structure and how emails are stored under this email format (I do forensics for a living, so perhaps I’m looking at this from a more complicated perspective). I don’t believe that these attachments are saved there automatically; only when they’re opened to be viewed from inside the email. And they are certainly left behind. Regardless, there’s got to be a way to clean up this unholly mess of folders and attachments. (Continued)

    Phil
    12/22/16 @ 3:28 pm

    Even when the emails are removed, there are hundreds of empty folders that are left behind. As we usually use TimeMachine backups to set up a new MAC, we end up carrying junk from years ago, which in addition to taking up space, they slow down the system. I’m getting a new MacBook and as painful as it’s going to be, I’m thinkin of not using a backup to set it up, but set up everything manually. Hopefully, that’s going to get rid of some of these email remnants. (Continued)

    Phil
    12/22/16 @ 3:30 pm

    If you hear of an app that can be used to clean up this mBox mess, I’d love to hear about it. Thanks again for taking the time to answer my questions. Happy holidays and happy New Year. Best regards, Phil

    12/22/16 @ 3:34 pm

    Phil: So, OK, you are using the Remove Attachments function or just deleting these emails, correct? If not, then of course the attachments will still be there as you haven’t indicated that you want them removed.
    Also, remember to check your settings in Mail, Preferences, Accounts, (select account), Mailbox Behaviors to see when a deleted messages is really deleted.

    Then, once you have done these things, are you trying Mailbox, Rebuild? That should rebuild the mailbox database from the ground up and get rid of things that are “trash” but haven’t been deleted yet. This could be the key that you are missing here.

    Also, not that if you are using IMAP email (and we pretty much all are now) that what you see in your mess of mBox files on your Mac is just a reflection of what is on the server. So the real solution may be there, not on your local Mac.

    Phil
    12/22/16 @ 4:12 pm

    Thanks for the feegdback, Gary. I have to keep a large archive of emails two or more years on the server, as I work from multiple computers and need to be able to access older messages from time to time. I then try to archive them to an external drive. If I deactivate automatic attachment downloads, can I still get them when I double-click on the attachment? I’ve rebult the mailboxes, but it’s been a while, so that may help. Thanks again.

    12/22/16 @ 4:13 pm

    Right. If automatic downloads are off, then you can still manually download them.

    Phil
    12/22/16 @ 4:49 pm

    Thanks again. You’ve been most helpful.

Comments Closed.