curl / Mailing Lists / curl-library / Single Mail


Fetching emails via imap without setting the "\Seen" flag (i.e. using BODY.PEEK)

From: Luca Di Rocco via curl-library <>
Date: Wed, 13 Mar 2019 12:31:06 +0100


I need to fetch via IMAP the latest emails from a mailbox, without
setting the \Seen flag (i.e. by using either FETCH <id> BODY.PEEK[] or
UID FETCH <uid> BODY.PEEK[] commands).
I have tried with several imap URLs, but curl always translates
".../;MAILINDEX=<id>" into "FETCH <id> BODY[]" (and ".../;UID=<uid>"

RFC 5092 "IMAP URL Scheme" always shows BODY.PEEK in the url
transaltion examples.
Is the curl url-imap translation correct or should it be regarded as faulty?

I have also tried with custom commands ( e.g. -X "FETCH <id>
BODY.PEEK[]" ) and there is no message returned by curl (I can see
messages only with -v option, but there are some extra characters that
would need to be filtered out).

Can you please help me understand if there is a way to use curl to
fetch an email leaving its status unread?

Thank you and kind regards,
Luca Di Rocco
Received on 2019-03-13