4

Somewhere lost in my Gmail is a Windows key. It's by itself in an email but I cannot find it. It's formatted like so:

XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

If Gmail supported regular expressions it would be easy.

.....-.....-.....-.....-.....

But since they don't, does anyone have any other suggestions? I did try this script to search it but it hit a maximum timeout and didn't make it very far into my email (there are a lot of them).

3
  • I have the same issue as well sometimes. I find it by searching for Microsoft Windows Order and it usually pops them up.
    – kobaltz
    Jun 7, 2013 at 3:52
  • why is this moved to WebApps? This is a superuser Windows question.
    – user41622
    Jun 7, 2013 at 18:11
  • @magicandre1981 Don't ask me...
    – CatDadCode
    Jun 7, 2013 at 19:18

1 Answer 1

3

Two solutions here:

  1. Google Drive Spreadsheet - Continue with using the speadsheet as linked, but limit the search area to avoid hitting the "Exceeded maximum execution time".
  2. Download via IMAP

1. Google Drive Spreadsheet

It's possible via a Google Drive Spreadsheet.

The original credit for Regular Expression based search of Gmail emails goes to Labnol.org.

Step by Step

Here are the step by step instructions from the original page modified to match the original questions requirements:

  1. Click here to make a copy of the Gmail RegEx sheet into your Google Docs account.
  2. Wait for 10-15 seconds and a new Gmail RegEx menu will appear in your new Google sheet.
  3. Choose Initialize from the menu and grant the necessary permissions as requested by the program.
  4. The program will search your entire mailbox by default but if you would like to limit the search to any particular label (say Inbox or Spam), just put that label name in cell F3. In this case if you sent the email to yourself Sent might be the best label, see further notes below
  5. Now enter any regular expression in the cell F4. The regular expression you are looking for is ([A-Za-z0-9]{5}(?:-[A-Za-z0-9]{5}){4})
  6. Choose Search Mailbox from the Gmail RegEx menu to begin searching.
  7. Wait and wait some more.

In my test case the first result took over 4 minutes to retrieve.

Exceeded maximum execution time

You may experience the Exceeded maximum execution time error. In this case I would limit your search by creating a custom label covering a specific time period in GMail before commencing the search. I.e:

  1. Open Gmail
  2. Search between 2012/01/01 (Jan 1st) and 2012/04/01 (April 1st) in Sent.
  3. Mark all emails with label searchblock1.

This alternative label (searchblock1) should be entered in cell F3 instead of Sent.

Other limits

The original article dated July 2012 also notes (although limits might have changed):

Please do note that Google Apps Script allows you to perform 10,000 read operations in Gmail per day.

Multiple Google Accounts

Also note that looking at the code this only searches the "primary" user account i.e. https://mail.google.com/mail/u/0/ if you are using multiple Google accounts you may want to change this to https://mail.google.com/mail/u/1/ etc.

2. Download via IMAP

You will need to ensure IMAP support is enabled for your GMail account in settings for these.

  1. Use a IMAP client that supports regular expression search
  2. OR IMAP backup tool to download as a ".mbox" file and search the plain text output locally.

Not tested but Thunderbird add-on Expression Search / GMailUI says it supports regex searches.

And for IMAP backup the first one that comes up is IMAP Backup Tool.

Either of these could be used with a limited search marked by initially using Gmail to label a range of interesting emails (say by date and sender) and then only downloading / searching those locally via the IMAP folder / label.

3

Your Answer

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

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