On Thu, 2008-09-11 at 17:43 -0700, tcowin wrote:
I need to write a little client to just get the 5 most recent email headers (and \Seen status) from the INBOX of a given user. Are there any API examples anywhere that would speed this process along, or any spots in the source that would give me a jump start? or would it be better to act as an IMAP client?
I'd suggest doing it via IMAP:
1 login user pass (perhaps use master user logins - see wiki) 2 select inbox [store $max = EXISTS's value] 3 fetch ($max-5):$max (body.peek[header] flags)
Dovecot's API is still changing between versions, but if you really want to use it, you could see e.g. src/pop3/client.c init_mailbox() and src/lib-storage/mail-storage.h for functions what you can do with a struct mail (mail_get_flags(), mail_get_stream()).