Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

Somewhere lost in my gmail is a windows key. It's by itself in an email but I cannot find it. It's formated 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).

share|improve this question

migrated from superuser.com Jun 7 '13 at 17:48

This question came from our site for computer enthusiasts and power users.

    
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 '13 at 3:52
    
why is this moved to WebApps? This is a superuser Windows question. –  user41622 Jun 7 '13 at 18:11
    
@magicandre1981 Don't ask me... –  Alex Ford Jun 7 '13 at 19:18

1 Answer 1

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.

share|improve this answer
    
    
@Alex note the specific details of using a label like "searchblock1" to reduce the search area to an amount that won't hit the execution limits. On testing my first result was over a year old with serveral 1000's of emails searched, keep the search area small and you'll get there. –  Dean Taylor Jun 14 '13 at 9:50
    
@AlexFord Updated answer to include alternative option for you - IMAP. –  Dean Taylor Jun 14 '13 at 13:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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