MacOS – How to delete attachments from mails I sent

In Mountain Lion’s Mail app, I can delete attachments from mails others have sent me, but not from the mails I sent to others.

In the mailbox, the messages I have sent are not marked with the small paperclip, even when then have a attachments (however, their size is correct and includes the big attachments). When I select an individual message (or many), the "Delete attachements" menu item is grayed out.

How can I deleted attachments from mails I sent?

Best Answer

Based on the page I used the steps bellow.

** Method recommended only for those who feel comfortable using the Terminal **

  • open the terminal app (Applications > Utilities > Terminal)
  • change to the directory/folder with the emails typing in the terminal window

    $ cd ~/Library/Mail/V2
  • list the folders you have

    $ ls


    $ ls -1
  • you will obtain something like:

    $ ls -1
  • go to the folder of the account you want to clean, list the files and the result shows one or more mbox

    $ cd
    $ ls -1


    $ ls -1
  • if you have only one mbox, go to this folder, list it and you will see

    $ cd INBOX.mbox
    $ ls
    Deleted Messages.mbox
    Sent Messages.mbox
  • change to the folder of the messages sent (note the backslash before the space) and list to see the files

    $ cd Sent\ Messages.mbox
    $ ls 
  • the first file is a folder and contains all the messages and attachments in a series of subfolders. Now you will use the powerful unix find command to find all the files to be deleted and delete them.

  • the find command can recursively descends the directory tree to search files by name and by size (among other options), so if you know that the attachmentes to be deleted are PDF files with more than 200k you can use the first command to find and list the files. Then if it's ok, delete them with the second command. The second example will find and delete zip files with more than 1 MB.

    $ find . -iname "*.pdf" -size +200k
    $ find . -iname "*.pdf" -size +200k -delete
    $ find . -iname "*.zip" -size +1M -delete
  • and if you want to delete all attachments bellow the present folder, you can use one simple command. To confirm that you are at the correct folder verify first printing the working directory. Then, remove every Attachments folders bellow it.

    $ pwd
    /Users/user/Library/Mail/v2/ Messages.mbox
    $ find . -iname Attachments -exec rm -R {} +
  • repeat these operations on all mbox of the account