Slightly OT. Good IMAP search tool?

James Hess mysidia at gmail.com
Sat Feb 20 15:46:59 CST 2010


On Sat, Feb 20, 2010 at 2:34 PM, Mike Lyon <mike.lyon at 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 "[email protected]" 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 at xxxxxxxx> run-parts /etc/cron.daily" (("root" NIL
"root" "")) (("root" NIL "root" "")) (("root" NIL "root" "")) NIL NIL
NIL NIL "<1237712530_8351 at 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




More information about the NANOG mailing list