Search code examples
emailimap

IMAP: Return several headers in one command


I am new to IMAP commands, but I know that in IMAP you can use this command to get header of a message:

fetch Message_Id (RFC822.HEADER)

or

fetch Message_Id:* (body[header.fields (from to subject date)])

where Message_Id is the message id like: 1, 2, 3 ...

so i need a command that gets the headers of all messages in a selected folder with only one command, that I receive a list of headers, something like this:

fetch * (RFC822.HEADER)

or

fetch *:* (body[header.fields (from to subject date)])

is that possible? is there such a command?


Solution

  • : is for a range. So 1:3 means messages from 1 to 3.

    * does not mean "every message", it means "the last message", whatever that may be.

    So, the range you want is simply 1:*, from message 1 until the last message.