84

My Gmail account is starting to get full, so I have been using the new search term larger:1M to find messages containing attachments that are larger than 1 Megabyte.

How do I delete only the attachment without deleting the email itself?

0

7 Answers 7

33

Yes.

You can access your Gmail account as an IMAP account using an email client such as Thunderbird or MS Outlook and then use the client’s feature for deleting attachments.

Also you can automatically forward the messages to yourself and remove the attachment with Google's Docs. See Delete only Attachments in Gmail without Deleting the Emails using Google Docs

2
  • @jjs: I've noticed that Apple Mail doesn't work properly anymore. It removes the attachment from the email but then leaves behind a copy of the original email (which is only visible in the Gmail webapp). This leads to a cumbersome workflow: remove attachment in Apple Mail, then look for the same email in the Gmail webapp, click on the copy with the attachment, then click the "..." menu and select "Delete". Is there a better way to do this with Apple Mail? Commented Mar 14, 2021 at 6:52
  • @AlexRoberts Found the same trouble. Look at Aaron's answer (webapps.stackexchange.com/a/166429/340214), it does fix it. The easiest way is to go through a local copy so that you keep control of where the modified emails are.
    – hmijail
    Commented Aug 9 at 7:59
58

I created Unattach, a web app that lets you mass delete Gmail attachments without deleting the email. You can also download attachments, resize image attachments, remove duplicate attachments in threads, or upload attachments to your own server or Dropbox.

0
36

(2022 Update in the edit below)

A Chrome extension was said to do this, but it was unclear for me (I didn't find the answer on their website) if our emails' content and attachments - i.e. our personal data - transit via this 3rd party company's servers or not when using it. As it could be potentially dangerous to open our data to a 3rd party company, I never used it.

As mentioned in @IgorIschuk's answer, it is possible to remove attachments in emails (and keep the original text) by enabling IMAP in Gmail + Thunderbird, but the workflow is quite long.

Thus, here is a detailed workflow explaining how to mass remove attachments for, say, all the emails of your Gmail that have a size > 1 MB. In my case I had ~ 1050 such emails.

  1. First enable IMAP in Gmail's Settings. Also create a Gmail label named bigattachments, and configure it to be visible from IMAP.

  2. Install Thunderbird (tested with Thunderbird Setup 60.5.0.exe) and set up the Gmail account.

  3. In Thunderbird, go in All mail, right click on the columns, and enable the display of the column Size. Click on the Size column header to sort all your emails by size. Then select all the emails that have a size > 1 MB, and move them (with a drag'n'drop) to the bigattachments folder.

  4. Now create a local folder in ThunderBird named temp. Drag'n'drop to copy all the emails from bigattachments (IMAP, on distant server) to temp (local). This step can take a long time depending on the size of the data to be downloaded.

  5. Then install the addon AttachmentExtractor Continued (the original addon AttachmentExtract doesn't work on Thunderbird 60 anymore).

  6. Now select all the emails in the local Temp folder. Right click, select "Extract attachments", select a destination path for the attachments. Wait. Carefully check that the attachments are removed from the emails (you can check the Size column), and that they are saved in the destination path too.

  7. Now go to Gmail's web (https://mail.google.com/mail), go to Settings, temporarily switch to Conversation mode off, Save settings. Go to the bigattachments label. Check that the number of emails here is equal to the number of emails you processed in Thunderbird. (Note: if you don't switch to Conversation mode off, you won't be able to see the right count of emails, you would get a count of conversations instead!). Now delete all these emails in the bigattachments label. This is scary the first time, but it works. Wait a few minutes, refresh Gmail web, and enjoy the change from 5 GB of 15 GB used to 1GB used :)

  8. Go back to Thunderbird. Select all the emails in the local Temp folder. Drag'n'drop them back to the bigattachments label (IMAP). Wait for the upload.

  9. It's done! You can check on Gmail web that the bigattachments contain the same emails, but with attachments removed. You can now do the cleanup: a) Remove this bigattachments label (removing a label doesn't delete its emails), b) Go back to Conversation view on, c) Delete the Thunderbird's Temp local folder, or even remove Thunderbird.

Notes:

  • For me AttachmentExtractor Continued worked for normal attachments, but not for "inline images" (even if I checked Also extract embedded 'inline' images too), maybe this feature is not working yet. I you have a solution for this, please drop a comment.

  • Why copy the emails to a local folder Temp, extract the attachments there, delete the original emails in Gmail, and move the content from Temp back to Gmail? This seems unnecessarily complicated, and we could think "Let's apply AttachmentExtractor Continued directly to the bigattachments IMAP folder"! Short answer: the latter doesn't work, already tested! This is due to a Thunderbird bug.

  • If you only have a few emails to process (less than 10), it's not necessary to install the addon AttachmentExtractor Continued. You can skip step 5 and 6, and just click on every email of the Temp folder, and click on the bottom right part of the screen (I don't remember the name of this option, maybe it's in More...), you have a Detach feature. The only drawback is that this cannot be done for multiple emails at the same time.

  • Don't forget to do enable "Delete the attachment from the message" in the Tools > Addon options > AttachmentExtractor menu. If not, the attachments won't be removed from the emails! I don't know which of the 3 options is the best (normal Thunderbird code vs. Delete with AE's internal routine vs. Detach with AE's internal routine; BTW does anyone know what is the difference between the 2 last ones: Delete vs. Detach?), though.

    enter image description here


Update 2022-07-29

  1. It only works with specific older versions of Mozilla Thunderbird and AttachExtractor (add-on for the former). Thunderbird 68.9.0 downloads can be found here. AttachmentExtractor 2.0.12 can be found here.
  2. Enable IMAP in Gmail's settings.
  3. Create a new label called something like "attachments_for_deletion". If this is an infrequent admin task you can delete this label when finished.
  4. Install Thunderbird. When asked if you want to configure with a particular email, do so. Follow all the stuff about passwords and authenticating (I needed my phone to confirm to Google).
  5. VERY IMPORTANT! You absolutely have immediately to prevent TBird from updating automatically. The little devil will start trying to do that the minute you start it, so here are precise instructions: click hamburger icon (top right) --> Options --> Options --> Advanced (icon at bottom) --> tab "Update". Check "Check for updates but let me..." and uncheck "Use a background service...". It will still ask to update at least once, but ignore (obviously).
  6. Add the "AttachmentExtractor" add-on in TBird: Hamburger icon (top right) --> Add-ons --> Add-ons. Gearwheel icon --> Install Add-ons from File. Find the file downloaded in step 1.
  7. "Restart" when TBird asks whether you want to.
  8. Select (in TBird) the emails you want to process in the "folder" "Inbox" (or any other "folder" - each represents a label in your account) under your account. If you want to see the (data) size of emails, for example, click on the little icon at the far right (right of column "Date") in Tbird and check "Size". Then you can, for example, order by size, by clicking the relevant column. Then select.
  9. Create a local folder in the Thunderbird app (right-click "Local Folders") named "temp".
  10. Drag'n'drop (in TBird) to copy the emails you have selected from "attachments_for_deletion" (this folder icon is on the distant server) to temp (local folder). This step can take a long time depending on the size of the data to be downloaded. There is no indication that things are happening. Try with a few emails initially until you have confidence it works!
  11. Select (in TBird) all the emails in the local temp directory.
  12. Right-click and choose "AE Extract from messages" --> "Just Delete attachments...". Confirm (click OK when it says "are you sure?")
  13. Select all these emails in temp, and Drag'n'drop back to the "attachments_for_deletion" folder. This should take minimal time because your attachments have now gone!
  14. Select emails in "attachments_for_deletion" and return them (Drag'n'drop) to the account's folders as appropriate. What you are actually doing by this process is, for each message concerned, removing the tag "attachments_for_deletion" and adding the tag of the "subfolder" concerned.
  15. Done! Now look at your emails in your Gmail web client. Initial disappointment: the attachments still seem to be there. But look closer: they now say "Deleted: My_file_which_used_to_exist.doc". If you click on the icon of the attachment, Google will respond with a confused message: "Couldn't preview file ... "
21
  • 4
    This sounds cool, I have to try it! The way TB natively detaches attachments is quite cool. It leaves behind an <1KB file with the same name (text file). So when you go back to Gmail you can see that there was an attachment and what it was called. Commented Nov 17, 2019 at 10:45
  • 3
    I'm surprised this answer doesn't have more upvotes. The Thunderbird bug described in the comments to the 1st answer seems to be the standard behavior of all IMAP clients (I also tried Outlook and IMAPSize, they also just create an additional copy of the email, leaving the original with the attachment in place). I was about to give up and pay Google for more space, when I found your answer.
    – Dan Z
    Commented May 12, 2020 at 14:55
  • 1
    @iJames For this reason, you can easily keep a "portable installation" of Thunderbird 77 somewhere that you only use once a year to perform this action. That's what I do, see superuser.com/questions/1561967/….
    – Basj
    Commented Jan 3, 2021 at 9:15
  • 1
    @Basj I don't see releases between 68 and 78 being available for download: thunderbird.net/en-US/thunderbird/releases. Looks like none of them went past a beta stage: en.wikipedia.org/wiki/History_of_Mozilla_Thunderbird. I guess 68 is what we should use then?
    – haridsv
    Commented Jan 10, 2021 at 4:42
  • 1
    @haridsv In fact, I only use Thunderbird once a year to do this process. So even a good old Thunderbird 60 does the job perfectly.
    – Basj
    Commented Jan 10, 2021 at 12:50
9

No.
You can't delete an attachment in Gmail without deleting the email it is attached to. You can forward the message to yourself and manually remove the attachment before hitting send. Then you can delete the original message. Just be sure to use the delete option on that message and not for the entire conversation.

Personally I don't recommend using Gmail as an archive solution. If you are using Google Apps, the enterprise version of Gmail, the message could be expunged by a company policy at any time. If your Gmail account is compromised the messages could be deleted by the attacker.

If the data is important, create a Google Doc and paste the information in it. You can now share this info with others should you wish to share or collaborate on it.

5
  • 1
    And what do you base this conclusion on? If you can prove it's wrong, please show your reference(s) and I'll be happy to edit or remove my answer.
    – Folk
    Commented Mar 25, 2019 at 15:24
  • Based on what is posted in the accepted answer (that can be taken as a reference), as one option I am familiar with. That is what I used quite a few years ago. Perhaps you mean that you can't remove an attachment from a web browser... If so, it would be good to mention it explicitly. Commented Mar 25, 2019 at 16:09
  • 1
    I think I see what you mean, but this is the 'web applications' Stack Exchange and the questions was about GMail. I'm addressing the question in the context it was asked. The accepted answer you reference provides a workaround that involves installing a local (non-web application) email client. So the answer I gave, that you can't accomplish this in Gmail itself, is still accurate.
    – Folk
    Commented Apr 9, 2019 at 13:56
  • 1
    Well, this is an "edge" case... Gmail is per-se web based, but there are non-web based interfaces that interact with it, so there is likely no clear-cut classification of the accepted answer as a "workaround". Indeed, the question (rephrased to make it a question) is "Can I just delete the attachment without losing the email itself?" It does not ask "Can I just delete the attachment from within Gmail without losing the email itself?" Commented Apr 9, 2019 at 21:54
  • It's already a question: "Can one delete a Gmail attachment but keep the email?" so to me that means within Gmail. If the question were just about how to delete an attachment from any email, well then I don't think it would be in the Web Applications stackexchange. The nature of the question including the word Gmail and being tagged with Gmail indicates the question is about solutions within Gmail.
    – Folk
    Commented Apr 11, 2019 at 17:42
9

The ability to delete the attachment from an email, without deleting the email itself is one of the annoyingly missing Gmail's feature. You can't do this from the Gmail user interface. You can achieve this though, by programmatically modifying the emails using Gmail API. This is exactly what I did. I created a simple tool that you can use to extract attachments from emails - feel free to check it out:

Gmail Attachments Extractor 📤

4
  • 1
    Works perfectly! This script helped me process 31,000 emails. It's a little tedious to set up the authentication in google cloud portal, but that's not the author's fault. The script's output is fantastic, the instructions are complete, and the functionality is great. The image based auth walkthrough was especially thoughtful given that it's not really the author's problem, but it is the main onboarding challenge for the script. The author even correctly recommends a security cleanup process of revoking the tokens you grant in order to execute the script. Kudos! Thanks Tomasz!
    – SimplGy
    Commented Jun 29, 2021 at 16:28
  • Do the copied emails preserve the original attributes such as the original date?
    – dan
    Commented Jul 27, 2022 at 0:52
  • 2
    @dan Yes. It does preserve all the standard attributes (e.g. date, from, to, subject), and extended attributes (e.g. Gmail stars and labels). The only attribute that is changed is the Message-ID, because every email must have a unique Message-ID.
    – TeWu
    Commented Jul 28, 2022 at 9:57
  • @TeWu then this is by far the best answer. I'll give it a try. Using a 3rd party such as Firebird is fine although very cumbersome, and the other guy suggesting the app he developped but selling it... it is what it is.
    – dan
    Commented Jul 29, 2022 at 20:03
8

The Chrome extension Dittach promises to be able to delete individual attachments.

A short description/review is available at ZD Net.

2
  • 2
    Are the emails processed on Dittach's own servers (i.e. email content + attachment) or is everything done on client side with no data at all transiting on Dittach's servers? Also what kind of permission does it require? It's always scary to give permission to our mailbox to a company like Dittach that could potentially be hacked (probably much easier than Gmail themselves...)
    – Basj
    Commented Feb 8, 2019 at 14:03
  • 4
    Dittach no longer working as of Jul 2019 - seems like company folded? Commented Aug 2, 2019 at 20:36
3

Basj's answer here is a good approach. My answer is a modified version, which only works for macOS, because Basj's answer suggested that I might need to install an old version of Thunderbird, which I didn't want to deal with. Instead, I used macOS's Mail program. The difference between Mail and Thunderbird for this use case is that Mail can remove attachments from many emails at once, but Thunderbird needs an extension (AttachmentExtractor Continued) to do it for more than one email at a time, and the extension has historically not always worked with the latest version of Thunderbird. That said, I don't see a way for Mail to extract the attachments (rather than just delete them), so if you want the attachments themselves extracted to a local folder then you might need to make Thunderbird work.

  1. (Optional) Go to takeout.google.com and download your Gmail data in case you delete something by mistake. (But it still might not be easy to restore if you delete something by mistake.)
  2. Gmail setup (same as Basj mentioned): (a) "Go to Settings, temporarily switch to Conversation mode off, Save settings" so that you can be sure you're dealing with just the emails for which you want to remove attachments, not other emails in the same conversation threads. (b) "Enable IMAP in Gmail's Settings. Also create a Gmail label named bigattachments" and fill it with the emails for which you want to remove attachments.
  3. Additional Gmail setup: Create another label bigattachmentsRemoved. For now, it is empty.
  4. Link Mail to your gmail account. Wait until all the emails in bigattachments are synced.
  5. On the left panel, hover over "On My Mac" and click + to create a new local mailbox named temp. This is analogous to creating a local folder in Thunderbird in Basj's answer. It should only exist on your Mac; you shouldn't see it in the Gmail web interface. Select all the emails in bigattachments and copy them to temp.
  6. View -> Show Message Size. This is important to be able to recognize when attachments have been successfully removed, because Mail can take a long time to do that for many messages, and doesn't show a progress bar!
  7. Select all the emails in temp, then Message -> Remove Attachments. This might take a while, and the only indication that it is finished is when the displayed size decreases.
  8. Select all the emails in temp and copy them to bigattachmentsRemoved.
  9. Go to Gmail's web interface and wait for the emails in bigattachmentsRemoved to sync. Compare them to the emails in bigattachments; they should match except that attachments should be missing or replaced with "empty" attachments.
  10. Delete all the emails in bigattachments.
  11. They're still in Gmail's Trash. Go there, review the items, then click Empty Trash Now to reclaim the storage space.
  12. Do any cleanup you like with respect to temp and the Gmail labels you created.

For background, the reason why both of versions of this approach (Thunderbird and Mail) involve removing attachments from local copies, deleting the originals, and uploading the modified copies is because Gmail won't let you directly remove an attachment from the original. Gmail will just add a new email and keep the original (with attachment) if you try to do that.

2
  • Thank you lots for the last paragraph; I thought those local steps were unnecessary, so I tried just applying "Remove Attachments", which at first seemed to work but then does weird stuff because of the Gmail behavior you mention + some visual deduplication that Mail.app itself seems to do, which makes the thinned emails invisible on the desktop. It ends up looking like the attachments get deleted but then somehow are resurrected. After trying for a good while to save steps by using Gmail labels, I think your local steps are actually the best option.
    – hmijail
    Commented Aug 9 at 7:40
  • 1
    One useful detail is that some emails can't have their attachments removed; this also happens in the Thunderbird solution, so there must be a reason. Those emails will survive the whole process untouched. The good part is that when reuploaded to Gmail, it recognizes that those emails are still the same. But now they will have both the bigattachments and bigattachmentsRemoved flags, so now it is easy to recognise them as problematic and decide what to do with them. (In my case these are all old bank emails with PDFs attached, so I can just delete them all)
    – hmijail
    Commented Aug 10 at 1:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.