Searching for mail in an IMAP client cache

One day I discovered that needed mail was missing from my IMAP server. Hoping to find them, I searched in the cache of a little-used mail client. Here’s how I did it.

The following was done with an instance of Evolution 2.30.3, and Opera Portable 11.61 on a USB stick mounted on Linux, but the approach should be generally applicable to mail clients generally.

In a terminal, I cd’ed to the mail client’s IMAP cache. In my case that was:

  • Evolution: ~/.evolution/mail/imap/ACCOUNT/folders, changing ACCOUNT as needed
  • Opera Portable: /media/DEVICE/PortableApps/OperaPortable/Data/profile/mail/store, changing DEVICE as needed

Then I searched for strings I knew the missing messages contained. The following worked for Opera (and presumably mail clients generally) to search for either “foo” or “bar”:

$ find . -type f -exec egrep -ni --color=always "foo|bar" {} +

The results will show files and line numbers, one hit per line.

Evolution has metadata files mixed up with mail files, making the output of the above unsuitable. To exclude them:

$ find . ! -path 'cmeta' ! -path 'journal' ! -path 'summary*'  -type f -exec egrep -ni --color=always "foo|bar" {} +

About Warren Post

So far: Customer support guy, jungle guide, IT consultant, beach bum, entrepreneur, teacher, diplomat, over-enthusiastic cyclist. Tomorrow: who knows?
This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s