65

Google has started to warn me that I am almost out of space in my Gmail account. How can I sort my messages by size to identify any expendable large emails in my account?

0

13 Answers 13

36

This is not possible at the moment. If you look at the list of search operators, you'll see that the closest thing you can do is filter out all emails with an attachment.

An alternative would be to use an IMAP client (such as Thunderbird) and then use that interface.

Since you want that feature, express your needs over at the feature-suggestion site of Gmail.

Update 2014-02-20: Gmail has now size: and larger: operators.

2
  • 1
    If you're a programmer, you can also use the IMAP interface to query by size. That's how www.findbigmail.com does it.
    – mm2001
    Commented Mar 17, 2012 at 0:31
  • 7
    This is possible now: See steabert's post below: webapps.stackexchange.com/a/31431/19241 Commented Oct 15, 2012 at 18:05
35

When I had to search for a large e-mail, I went for the try-and-see-if-it-works method and used the search term size:5000000 to find e-mail of 5MB large, and that seemed to actually find all my emails larger than 5MB. I tried different numbers and it seemed to work consistently.

Even though this operator isn't documented in the advanced search options, it worked for me. :)

As of November 2012, this is now an officially-supported search operator. The syntax is a little different than it was.

to find emails larger than 5MB, you can search for size:5m or larger:5m

3
  • 1
    This is actually working!
    – Alex
    Commented Sep 24, 2012 at 9:56
  • I know, great isn't it!! ;)
    – steabert
    Commented Sep 24, 2012 at 10:00
  • 3
    This is now an officially supported search operator.
    – ale
    Commented Nov 15, 2012 at 1:49
9

Sadly you can't sort by size so you might find this article at Lifehacker on how to clear down your Gmail account useful.

One of the recommendations is using the filename: operator to find larger attachments, e.g. filename:wmv

9

This isn't exactly the quickest way, but you could search by file types first, which might help you narrow down large e-mails. For instance, you could do a search for video file types (which are huge) first, like this:

has:attachment (*.mov || *.wmv || *.avi)

or zip files, like:

has:attachment (*.zip || *.rar || *.7z || *.tar.gz)

Etc., etc. Hope that helps!

1
  • Sorry...I didn't realize Dave Webb had said something similar. My bad.
    – jrc03c
    Commented Jul 8, 2010 at 13:54
7

Someone has worked out a way to do this with Google Docs. The beauty of this method is that you don't need to rely on a third-party; everything stays within the Google ecosystem.

The idea is that your Google Docs will connect to your Gmail account and compute the size of every message that’s present in your mailbox. If it finds a bulky message (size > 1 MB), it will make a note of it in the spreadsheet.

Once the sheet has a list of all the bulky message, you can sort the sheet by the Size column to find the big ones. Or use the Filter option (the Funnel icon) to find messages that are within a particular range (5 MB < size < 10 MB). Click the “View” link to open the corresponding message in Gmail, forward it to a secondary email address and delete it from the primary Inbox to recover space.

That’s all the theory you should know, let’s now put this program into action:

  1. Create a copy of this sheet in your Google Docs account.
  2. A new Gmail Menu will appear in the sheet after 5-10 seconds. Select “Reset Canvas” from the Gmail menu to initialize your sheet.
  3. Accept the authorization screen and then choose Grant Access to let Google Docs access your Gmail Inbox. This is completely safe because your own Google Docs account is requesting access to your own Gmail account (see source code).
  4. Once the permissions have been granted, choose “Scan Mailbox” from the Gmail menu to start the scanning process.

Sit back and relax as the last step may take time depending on how big your Gmail mailbox is. Also, if the program is stuck or if you accidentally close the browser tab, open the same Google sheet, choose “Scan Mailbox” again and the script will resume scanning from where it left off.

Note: I have not tried it.

6

FindBigMail will label all your large quota-killing messages. Just click the various labels to show messages that are greater than the size indicated by the label.


... or this is a very round-about way, but you can:

  1. Download your emails with Gmail Backup. Each individual email is downloaded as an EML file. Many email programs can read EML files; they are just plain text.
  2. Prune out all the large EML files. You can sort all the EML files by size.
  3. Restore the backup to Gmail. You will probably need to delete the messages from Gmail, first.

I am using Gmail Backup to migrate my mail to a new Gmail account. Also, I am fixing the timezone on several emails. (They got the wrong timezone because I imported an Outlook IMAP store from a computer with a different timezone.)

1

Download them all to Outlook and sort the emails by size. Using IMAP should download them (e.g. headers only) quicker.

If you don't like Outlook, then you can use Opera's email IMAP client. It works wonderfully with Gmail's IMAP implementation. (Well, not with Google Apps, but that's a different story.)

1

I found a cool iPhone app that handles this smoothly: http://itunes.apple.com/us/app/search-mail-by-size/id388632871?mt=8

I do most things from my iPhone anyway, so I really liked this solution when I needed to make some space in my mailbox.

1
1

There is a Chrome Extension for sorting emails by attachment size:

Sort Emails by Attachment Size For Gmail

2
  • 1
    Please do not use URL shorteners here.
    – ale
    Commented Jan 15, 2015 at 23:58
  • ERROR 404 (URL NOT FOUND)
    – user0
    Commented Jan 26, 2019 at 17:56
1

Here's a simple Google Script that will help you sort your mailbox by size in Google Sheets.

function Scanning_Gmail_Mailbox() {    

  if (!UserProperties.getProperty("start")) {
    UserProperties.setProperty("start", "0");    
  }

  var start   = parseInt(UserProperties.getProperty("start"));
  var sheet   = SpreadsheetApp.getActiveSheet();
  var row     = getFirstRow();
  var ss      = SpreadsheetApp.getActiveSpreadsheet()

  for (;;) {

  ss.toast("Now finding all the big emails in your Gmail mailbox. Please wait..", "Scan Started", -1);

  // Find all Gmail messages that have attachments
  var threads = GmailApp.search('has:attachment larger:1m', start, 100);

  if (threads.length == 0) {
    ss.toast("Processed " + start + " messages.", "Scanning Done", -1); 
    return;
  }

  for (var i=0; i<threads.length; i++) {

    var messages = threads[i].getMessages();
    UserProperties.setProperty("start", ++start);

    for (var m=0; m<messages.length; m++) {      

      var size = getMessageSize(messages[m].getAttachments());      

     // If the total size of attachments is > 1 MB, log the messages
     // You can change this value as per requirement.

      if (size >= 1) {      
        sheet.getRange(row,1).setValue(Utilities.formatDate(messages[m].getDate(),"GMT", "yyyy-MM-dd"));
        sheet.getRange(row,2).setValue(messages[m].getFrom());        
        sheet.getRange(row,3).setValue(messages[m].getSubject());
        sheet.getRange(row,4).setValue(size);        
        var id = "https://mail.google.com/mail/u/0/#all/" + messages[m].getId();
        sheet.getRange(row,5).setFormula('=hyperlink("' + id + '", "View")'); 
        row++;
      }
    }            
  }    
  }
}


// Compute the size of email attachments in MB

function getMessageSize(att) {
  var size = 0;
  for (var i=0; i<att.length; i++) {
    //size += att[i].getBytes().length;
    size += att[i].getSize(); // Better and faster than getBytes()
  }
  // Wait for a second to avoid hitting the system limit
  Utilities.sleep(1000);
  return Math.round(size*100/(1024*1024))/100;
}

// Clear the content of the sheet

function Clear_Canvas() {
  UserProperties.setProperty("start", "0");
  var sheet = SpreadsheetApp.getActiveSheet();
  sheet.getRange(2,1,sheet.getLastRow(), 5).clearContent();
  SpreadsheetApp.getActiveSpreadsheet().toast("Choose Scan Mailbox to continue..", "Initialized", -1);
}

// Find the first empty row to start logging

function getFirstRow() {
  var sheet  = SpreadsheetApp.getActiveSpreadsheet();
  var values = sheet.getRange('A:A').getValues();
  var c = 2;
  while ( values[c][0] != "" ) {
    c++;
  }
  return c;
}

// Add a Gmail Menu to the spreadsheet

function onOpen() {  
  var menu = [    
    {name: "Reset Canvas", functionName: "Clear_Canvas"},
    {name: "Scan Mailbox", functionName: "Scanning_Gmail_Mailbox"}
  ];

  SpreadsheetApp.getActiveSpreadsheet().addMenu("Gmail", menu);
}
1

There is now a way that you can order your large attachments by visiting https://one.google.com/storage/management. This also will show you other things taking up your Google quota (photos, drive).

1

In 2024, Google Drive has a "Clean up space" option that will list your large gmail messages, and give you an option to delete them. This is similar to iPhone's "Manage Storage". It does not sort messages by size, but it does show their size, which gmail client does not.

https://drive.google.com/drive/quota

0

There is searchgmailbysize.com which claims to list you at least attachments by size. Personally, I wouldn't trust the site with my credentials as it is not even using OAuth.

1
  • I tried with a throw-away account, and it works as advertised... however I think FindBigMail.com is more secure and usable (you can check the contents of the mail before deleting.)
    – Leftium
    Commented Nov 10, 2010 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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