On Mon, Feb 16, 2015 at 01:50:31PM -0500, Tim Evans wrote: > Looking for a command-line way to extract only the Subject lines from my > mailbox on my ISP's IMAP server, without actually downloading/modifying > the contents of the mailbox. Sort of the remote equivalent of locally > doing: telnet (or use openssl) to connect to the imap port. eg telnet localhost imap a1 LOGIN username password a2 SELECT INBOX a3 FETCH 1:* ENVELOPE a4 logout The "FETCH" command will give you output like: * 1 FETCH (ENVELOPE ("Mon, 16 Feb 2015 13:50:31 -0500" "[CentOS] OT: Extracting Subject Lines from IMAP Mailbox" (("Tim Evans" NIL "tkevans" "tkevans.com")) ((NIL NIL "centos-bounces" "centos.org")) (("CentOS mailing list" NIL "centos" "centos.org")) (("CentOS mailing list" NIL "centos" "centos.org")) NIL NIL NIL "<54E23BF7.7020009 at tkevans.com>")) * 2 FETCH (ENVELOPE ("Mon, 16 Feb 2015 19:33:43 +0000 (GMT)" "Re: [CentOS] OT: Extracting Subject Lines from IMAP Mailbox" (("Nux!" NIL "nux" "li.nux.ro")) ((NIL NIL "centos-bounces" "centos.org")) (("CentOS mailing list" NIL "centos" "centos.org")) (("CentOS mailing list" NIL "centos" "centos.org")) NIL NIL "<54E23BF7.7020009 at tkevans.com>" "<1705307878.67382.1424115223759.JavaMail.zimbra at li.nux.ro>")) >From RFC 3501 we can be sure of the order of the data: The fields of the envelope structure are in the following order: date, subject, from, sender, reply-to, to, cc, bcc, in-reply-to, and message-id. The date, subject, in-reply-to, and message-id fields are strings. The from, sender, reply-to, to, cc, and bcc fields are parenthesized lists of address structures. -- rgds Stephen