Re: [CentOS] OT: Extracting Subject Lines from IMAP Mailbox

2015-02-16 Thread Nux!
http://sourceforge.net/projects/imaputils/files/ ?

I guess you'll at least need to download and parse the email headers.

HTH
Lucian

--
Sent from the Delta quadrant using Borg technology!

Nux!
www.nux.ro

- Original Message -
 From: Tim Evans tkev...@tkevans.com
 To: CentOS mailing list centos@centos.org
 Sent: Monday, 16 February, 2015 18:50:31
 Subject: [CentOS] OT: Extracting Subject Lines from IMAP Mailbox

 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:
 
 $ grep ^Subject /var/spool/mail/mymailbox  subjectlistfile
 
 Thanks.
 --
 Tim Evans |   5 Chestnut Court
 UNIX System Admin Consulting  |   Owings Mills, MD 21117
 http://www.tkevans.com/   |   443-394-3864
 tkev...@tkevans.com
 ___
 CentOS mailing list
 CentOS@centos.org
 http://lists.centos.org/mailman/listinfo/centos
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] OT: Extracting Subject Lines from IMAP Mailbox

2015-02-16 Thread Bill Campbell
On Mon, Feb 16, 2015, Nux! wrote:
http://sourceforge.net/projects/imaputils/files/ ?

I guess you'll at least need to download and parse the email headers.

I do this sort of thing with Python and its 'imaplib'

Something like this will return a list of all unseen messages in
the security folder where Subject contains 'Sec-Blocked'.

import imaplib
conn = imaplib.IMAP4('example.com')
c, d = conn.login('username', 'password')
c, n = conn.select('INBOX.security')
c, s = conn.uid('search', None, '(UNSEEN HEADER SUBJECT Sec-Blocked)')
msgnumbers = s[0].split()
unseenUIDs = set(msgnumbers) # using set for later manipulations
for uid in sorted(unseenUIDs)
# do something for each uid

# done

HTH
Lucian

--
Sent from the Delta quadrant using Borg technology!

Nux!
www.nux.ro

- Original Message -
 From: Tim Evans tkev...@tkevans.com
 To: CentOS mailing list centos@centos.org
 Sent: Monday, 16 February, 2015 18:50:31
 Subject: [CentOS] OT: Extracting Subject Lines from IMAP Mailbox

 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:
 
 $ grep ^Subject /var/spool/mail/mymailbox  subjectlistfile
 
 Thanks.
 --
 Tim Evans|   5 Chestnut Court
 UNIX System Admin Consulting |   Owings Mills, MD 21117
 http://www.tkevans.com/  |   443-394-3864
 tkev...@tkevans.com
 ___
 CentOS mailing list
 CentOS@centos.org
 http://lists.centos.org/mailman/listinfo/centos
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


-- 
Bill
-- 
INTERNET:   b...@celestial.com  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
Voice:  (206) 236-1676  Mercer Island, WA 98040-0820
Fax:(206) 232-9186  Skype: jwccsllc (206) 855-5792

politics, as a practice, whatever its professions, has always
been the systematic organization of hatreds. -- Henry Adams
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


[CentOS] OT: Extracting Subject Lines from IMAP Mailbox

2015-02-16 Thread Tim Evans
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:


$ grep ^Subject /var/spool/mail/mymailbox  subjectlistfile

Thanks.
--
Tim Evans   |   5 Chestnut Court
UNIX System Admin Consulting|   Owings Mills, MD 21117
http://www.tkevans.com/ |   443-394-3864
tkev...@tkevans.com
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] OT: Extracting Subject Lines from IMAP Mailbox

2015-02-16 Thread Tim Evans

On 02/16/2015 02:33 PM, Nux! wrote:

http://sourceforge.net/projects/imaputils/files/ ?

I guess you'll at least need to download and parse the email headers.


Thanks.  Don't see this in the usual repos, but I do see the epel repo 
has something called uw-imap-utils, which seem to date to 2007. I'll 
take a look at both.



--
Tim Evans   |   5 Chestnut Court
UNIX System Admin Consulting|   Owings Mills, MD 21117
http://www.tkevans.com/ |   443-394-3864
tkev...@tkevans.com
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Re: [CentOS] OT: Extracting Subject Lines from IMAP Mailbox

2015-02-16 Thread Stephen Harris
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.7020...@tkevans.com))
* 2 FETCH (ENVELOPE (Mon, 16 Feb 2015 19:33:43 + (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.7020...@tkevans.com 
1705307878.67382.1424115223759.javamail.zim...@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
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos