Slightly OT. Good IMAP search tool?
Howdy Folks, What are people using these days to suck down an IMAP account, search it and then export the search results? Any suggestions. Cheers, Mike
On 20/02/10 11:56 -0800, Mike Lyon wrote:
Howdy Folks,
What are people using these days to suck down an IMAP account, search it and then export the search results? Any suggestions.
I don't know your specific need, but it is usually far more efficient (to what degree depends on the IMAP server) to perform your searches via the IMAP SEARCH command and let the server feed you the appropriate emails containing the keyword(s) you're searching for. -- Dan White
* Am Sat, Feb 20, 2010 at 11:56:19AM -0800 , schrieb Mike Lyon:
Howdy Folks,
What are people using these days to suck down an IMAP account, search it and then export the search results? Any suggestions. If you really need to suck everything down, i'd suggest offlineimap+maildir-utils
Cheers, Christoph
Cheers, Mike
Well, I don't have to exactly suck everything down. if I I could use the imap search function as one post previously mentioned, that would work to. Just trying to find a good utility to do it...Win/Linux, doesn't matter... Thanks, Mike On Sat, Feb 20, 2010 at 12:27 PM, Christoph <ck@iphh.net> wrote:
* Am Sat, Feb 20, 2010 at 11:56:19AM -0800 , schrieb Mike Lyon:
Howdy Folks,
What are people using these days to suck down an IMAP account, search it and then export the search results? Any suggestions. If you really need to suck everything down, i'd suggest offlineimap+maildir-utils
Cheers, Christoph
Cheers, Mike
On Sat, Feb 20, 2010 at 2:34 PM, Mike Lyon <mike.lyon@gmail.com> wrote: hm..If you really want to snarf the imap, think fetchmail for downloading. hypermail/pipermail for parsing. Get it into a DBM (such as PgSQL) and perform full-text indexing. Or coax Hypermail into generating HTML flat files.... Then your full-text search problem is reduced to finding the right .html files out of the massive number of files. If you want to search binary attachment contents, that's harder. Sounds like a job for a recursive 'grep' at that point. Or post (non-sensitive) output to a web site, wait for Google to index. Or (heck) use Google Desktop :) Else use a private web site ht://Dig. some other tools are (supposedly): Apache Nutsch, Sphinx, mnoGoSearch, SWISH-E.
Well, I don't have to exactly suck everything down. if I I could use the imap search function as one post previously mentioned, that would work to. Just trying to find a good utility to do it...Win/Linux, doesn't matter...
How about telnet + openssl, and perhaps an expect script? # openssl s_client -connect mail.example.com:143 -starttls imap or # openssl s_client -connect mail.example.com:993 a1 LOGIN myusername mypassword a1 LIST "/" "*" yawn SELECT INBOX a2 SEARCH SUBJECT "hello" a3 SEARCH SUBJECT "test" SEEN a4 SEARCH ANSWERED a5 SEARCH TEXT "xs-" BODY "cron" SINCE "20-Oct-2009 00:00:00 -0500" FROM "root@" TO "root" UNDELETED a FETCH 1012 FLAGS b FETCH 1012 full c FETCH 1012 BODY c FETCH 1012 BODY[text] blah LOGOUT --- * OK IMAP (C) example.com (Version 4.2) a OK login completed * LIST () "/" "Drafts" * LIST () "/" "INBOX" * LIST () "/" "Saved" * LIST () "/" "Sent Items" * LIST () "/" "Trash" a1 OK LIST completed * 2818 EXISTS * 3 RECENT * OK [UNSEEN 1] first unseen message * OK [UIDVALIDITY 1192121218] Uid epoch * OK [UIDNEXT 3319] Predicted next uid * FLAGS (\Answered \Flagged \Deleted \Draft \Seen $Forwarded ) * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Draft \Seen $Forwarded )] Limited yawn OK [READ-WRITE] SELECT completed * SEARCH 658 666 668 669 695 698 742 1104 a2 OK SEARCH completed * SEARCH 210 211 845 2497 2751 2753 2754 a3 OK SEARCH completed * SEARCH 1012 a4 OK SEARCH completed * 1012 FETCH (UID 1512 FLAGS (\Answered)) * SEARCH 2239 2245 a5 OK SEARCH completed * 1012 FETCH (UID 1512 FLAGS (\Answered \Seen)) a OK FETCH completed * 1012 FETCH (UID 1512 FLAGS (\Answered) INTERNALDATE "22-Mar-2009 03:02:11 -0600" RFC822.SIZE 1062 ENVELOPE ("Sun, 22 Mar 2009 04:03:02 -0500" "Cron <root@xxxxxxxx> run-parts /etc/cron.daily" (("root" NIL "root" "")) (("root" NIL "root" "")) (("root" NIL "root" "")) NIL NIL NIL NIL "<1237712530_8351@xxxxx>") BODY ("TEXT" "PLAIN" ("charset" "UTF-8") NIL NIL "7BIT" 97 3)) b OK FETCH completed * 1012 FETCH (UID 1512 BODY ("TEXT" "PLAIN" ("charset" "UTF-8") NIL NIL "7BIT" 97 3)) c OK FETCH completed * 1012 FETCH (UID 1512 BODY[TEXT] {97} /etc/cron.daily/logrotate: error: stat of /var/log/xha.log failed: ) c OK FETCH completed * BYE IMAP4rev1 Server logging out blah OK logout completed closed -- -J
On Sat, Feb 20, 2010 at 11:56:19AM -0800, Mike Lyon wrote:
What are people using these days to suck down an IMAP account, search it and then export the search results? Any suggestions.
I'd replied off-list, but then realized that perhaps this would be of more general interest. My apologies to Mike for the redundancy. I use fetchmail and grepmail. Grepmail emits as its output a Unix mbox file, so it lends itself quite nicely to going through chunks of saved mail, matching grep-ish criteria (including headers) and producing a file full of the messages that match. Let me also mention formail, which is part of the procmail distribution, and is also quite useful -- in this particular case, for culling duplicates. All three of these tools are part of my standard postmaster toolbox. ---Rsk
On Sat, Feb 20, 2010 at 04:45:03PM -0500, Rich Kulawiec wrote:
I use fetchmail and grepmail. Grepmail emits as its output a Unix mbox file, so it lends itself quite nicely to going through chunks of saved mail, matching grep-ish criteria (including headers) and producing a file full of the messages that match.
Have you figured out how to get grepmail to decode MIME? A mailing list I'm on recently started emitting MIME/base64 encoded inline text.
On Sat, Feb 20, 2010 at 11:56:19AM -0800, Mike Lyon wrote:
Howdy Folks,
What are people using these days to suck down an IMAP account, search it and then export the search results? Any suggestions.
Cheers, Mike
Check out mairix: http://www.rpcurnow.force9.co.uk/mairix/ """ mairix is a program for indexing and searching email messages stored in maildir, MH or mbox folders. """
participants (7)
-
Christoph
-
Chuck Anderson
-
Dan White
-
Derrick H.
-
James Hess
-
Mike Lyon
-
Rich Kulawiec