We Rock Your Web Forums Tech Troubleshooting Thunderbird – Mass Remove Attachments

This topic contains 11 replies, has 3 voices, and was last updated by  Guest 6 years, 5 months ago.

  • Author
  • #10562


    My Thunderbird attachments are taking up too much space! Is there a way to remove them? Is there a way to mass detach all Thunderbird message attachments?

  • #11432


    Would not install as it is not compatible with Thunderbird current version 3.0.6 !!

  • #10573

    Alex Schenker

    Thunderbird offers the ability to “detach” attachments from messages, so they don’t increase the size of your profile folder. This is particularly useful when you’re trying to get your profile folder down to a reasonable size, for say, backup purposes. Note that when you’re all done, you’ll need to compact your folders to actually recover the disk space (this goes for deleted files as well). You can do so by browsing to File -> Compact Folders.

    Here’s how to detach messages one at a time:

    Detaching Thunderbird messages one at a time

    • Open or select the email with the attachment
    • Right-click the attachment and select “Detach…” (note: if you select “Save As…” it will merely save a copy of the message – it won’t detach it and therefore won’t reduce the size of your email message)
    • You will be prompted with a save location for the attachment, after which you’ll be prompted again confirming that you want to delete the attachment from the message

    Note that once the attachment is deleted, you’ll still see it – ie. the filename will remain, even though the attachment is no longer there. This is useful for keeping track of what attachments were attached to specific messages. The attachment icon, however, will be removed, so you’ll know the attachment has been detached.

    How to mass detach all Thunderbird message attachments

    If you have a massive Inbox (and other folders) full of messages with large attachments, detaching them one by one could take an eternity. Wouldn’t it be nice to have an addon utility that lets you manage the detachment of Thunderbird messages for all your messages? Enter the Thunderbird Attachment Extractor.

    How to mass detach all your Thunderbird attachments

    First, browse on over and download and install the Thunderbird add-on, Attachment Extractor. Once you have it installed, we’ll show you some general configuration settings and tweaks that we find useful.

    Optimizing the Thunderbird Attachment Extractor settings for your needs

    Once you have the Thunderbird Attachment Extractor successfully installed (you may need to restart Thunderbird), browse to Tools -> Attachment Extractor Settings, and note the following settings changes that might prove useful (we’re skipping configuration changes that are self-explanatory and you can modify according to your liking):

    • Under the General tab, you’ll notice the second section entitled “After extracting the attachments should we:” See the screenshot for our settings preferences:

    Thunderbird Attachment Extractor - General Preferences

    • We’ve chosen to delete the attachment from the message. Why? Because if we don’t, we’ll run into the problem that Attachment Extractor freezes when trying to find a detached file that is no longer in the original save location.
    • We choose to use AE’s internal routine. Please note that while it works okay for us, it is experimental, which means it’s not advisable to use this on important files. AE advises that in some cases, file attachments may go missing or email messages end up blank. You may want to try it on some test messages first, or hold off until a more stable release is published. The reason we use this routine is because, if you use the normal Thunderbird code with a lot of attachments, Thunderbird will continually prompt you asking you to confirm that you wish to detach the file. As far as we’re aware, there’s no way to turn off this alert.
    • Under the Advanced tab, the change we made was checking the box “also extract embedded (inline) images,” as this will further reduce the size of your profile folder, and therefore make it easier to backup.
    • Finally, under the Filenames tab, we add the following extensions to “Extract all files except where the filename contains (default files in italics): *.eml; *.bat; *.exe; *.ade; *.adp; *.bas; *.chm; *.cmd; *.com; *.cpl; *.crt; *.hlp; *.hta; *.inf; *.ins; *.isp; *.js; *jse; *.lnk
      • For the filename pattern generation, we use the following pattern:
      • #fromemail#_#date#_#namepart##count##extpart#
      • Which results in a filename that we can sort by the sender of the email. We found this most practical for finding attachments later. An example filename using this pattern: jon.doe@example.com_2008-12-20_picture-1.jpg
      • Note that in order to get the date in the Month – Day – Year pattern we clicked the edit date pattern button and entered the following: Y-m-d
    • AE freezing Thunderbird? If editing these settings is causing weird behavior – ie. blank settings fields, an “OK” button that doesn’t work anymore, and Thunderbird crashing, check out the troubleshooting section below.


    AttachmentExtractor freezes while detaching a particular file (one of many)

    It also appears that if you previously detached an attachment, potentially with an older version of Thunderbird, and that detachment is no longer available, AttachmentExtractor will not be able to detach the file, and will freeze if it’s in the middle of detaching a string of multiple attachments.  To be more specific, this appears to occur with messages where you still see the attachment plus icon, but when you click on the attachment, it tries to find the attachment based on the previous save location, but can’t, and thus returns “file not found.”

    Solution – until a fix is released, the temporary solution to this problem is to close the extracting window (which by now has frozen), and then recreate an empty file with the same name as the one that was detached, and now cannot be found. Attachment Extractor will recognize the file name and resume processing the file.

    AttachmentExtractor crashes Thunderbird when you try and save settings changes

    This appears to be a common error when you try and edit settings on the Advanced page. The way around this is to edit the settings directly in Thunderbird’s config editor. For example, to directly edit the filename pattern generation, you would browse to (in Thunderbird) Tools -> Options -> Advanced tab -> Config Editor.

    This will bring up the config editor window, which may appear daunting at first sight. To make this simple, type the word attachmentextractor to filter out all the settings related to Attachment Extractor.  You’ll see the following screen:

    Thunderbird Config Editor

    The setting that reflect those we just set above are:

    • .actionafterextract.detach.mode
      • 0 = Delete with normal Thunderbird code
      • 1 = Delete with AE’s internal routine
      • 2 = Detach with AE’s internal routine
    • .excludepatterns4
      • The string here will reflect the file extensions to filter (ie. *.eml;*.bat;…)

    After playing around with the config editor for a while you’ll notice other settings from the user interface.

    Solution – the solution to AE causing Thunderbird to freeze is to use the config editor to manually enter the settings, in particular the filename exclude patterns. You’ll notice that even though the user interface may appear empty (prior to crashing Thunderbird), the settings are saved in the config editor, which is what counts.

    This way, you should be able to continue using Attachment Extractor until these bugs are fixed in the next release. Note that at the time of this writing we were unable to find a viable alternative to Attachment Extractor. If you find one, please post below.

    Compact your folders to recover disk space

    Once you’ve finished detaching and deleting your attachments, there’s one more final and important step you need to take to actually recover your disk space (ie. reduce the size of your Thunderbird profile folder). You need to compact your folders. To do so, simply:

    • Browse to File -> Compact Folders

    Thunderbird will do the rest. This may take a while, especially if you’ve never compacted your folders before. Compacting your folders will recover disk space not only from attachments you’ve removed, but also from any messages you’ve deleted, including those you deleted from your trash bin. If you are compacting for the first time, get ready to save a huge amount of disk space 🙂

  • #11433


    I use Thunderbird to access a Gmail IMAP account… thus, the space I want to free up is in my online Gmail inbox. When I “Detach” an attachment in Thunderbird, it indeed looks like it removes the attachments from the message in Thunderbird. But when I login to Gmail, I see that the original message WITH attachments has NOT been deleted, it is still there as well.

    Therefore, I am not actually freeing up any space in my Gmail account by “Detaching” the attachments. Does anybody know a way to get this to work as expected?

    • #11434

      Alex Schenker

      That’s interesting – with IMAP the action (detach) should take effect on the server (as opposed to POP, which merely transfers messages). Have you tried “delete” after saving the message to your PC to see if that makes a difference?

      The other thing to try would be to see if there’s a setting in Gmail you can adjust so that attachments are deleted on their server when you take an action in your mail client (Thunderbird).

  • #11435


    You keep talking about how this method detaches the files. It does not. It saves the files and then removes them. There is no longer a connection from the original file to the attachment as there would be when you do a “detach” from Thunderbird.

    Is there any way to accomplish this “mass detach” where the attachments are actually detached in the conventional sense?

  • #11436


    It saves a copy of the attachment but doesn’t detach it.

  • #11437


    What I really need to do is detach things I SENT. Keep the text, drop the attachments. Can it do that?

    • #11438

      Alex Schenker

      Try upgrading Thunderbird to the latest version (make a backup of your data files first). If that doesn’t help, try saving the attachment and then deleting it. The only drawback is that the pointer the “detach” function it creates isn’t created, but the drawback to detaching will always be that if you ever move your destination file, the link to that file won’t work.

  • #11439


    I just installed AE 1.3.5 into Thunderbird 3.1.6 on Windows 7. After restarting Thunderbird, I selected a group of messages, some with attachments, and picked “Extract from selected messages” on the context menu. Nothing happens; no JavaScript errors. I have tried for a single email message, and for an entire mail folder with the same results. My AE settings include “delete attachment with normal Thunderbird code” and “notify me when all have been extracted”. No other check boxes are enabled on the “after extraction” tab.

  • #11440


    FWIW, I just went through an archive file checking for large attachments, and found I couldn’t delete 2 of them. TB (3.1.7, Windows 7 32bit) went through the motions and gave no error, but the attachments remained attached. They were large videos — 5MB and 10MB — with other MIME parts in the messages. I ultimately deleted the entire message, and they went into Trash normally (with their attachments). Whatever bug this is might be affecting AE as well.

  • #11441


    IMAP solution simple. Just delete files in TB [Gmail].sbd folders and resynchronize mail. File size will reduce 10-20 times. 3GB vs 100kb in my case 😉

You cannot reply to this topic.

Send this to a friend