Some IMAP Commands

curl --url "imaps://mail.server.com/Map" --user "user:password" --request "SEARCH (SEEN)"

* SEARCH 1 2 3

curl --url "imaps://mail.server.com/Map" --user "user:password" --request "SEARCH (UNSEEN)"

* SEARCH

curl --url "imaps://mail.server.com/Map" --user "user:password" --request "FETCH 2 FULL"

* 2 FETCH (FLAGS () INTERNALDATE "05-Jul-2019 12:06:39 +0200" RFC822.SIZE 1449 ENVELOPE ("Fri, 05 Jul 2019 12:06:21 +0200 (CEST)" "test 2" (("Erik Winter" NIL "erik" "mail.com")) (("Erik Winter" NIL "erik" "mail.com")) (("Erik Winter" NIL "erik" "mail.com")) (("todo" NIL "todo" "mail.com")) NIL NIL NIL "<E1hjL6j-0006ug-DS@rmmprod05.server>") BODY ("text" "plain" ("charset" "utf-8") NIL NIL "quoted-printable" 11 1))

curl --url "imaps://mail.server.com/Map" --user "user:password" --request "STORE 1:* +FLAGS \Seen"

* 2 FETCH (FLAGS (\Seen))
* 3 FETCH (FLAGS (\Seen))

Sources