With CURL plugin functions you can use the IMAP protocol for downloading emails. The plugin connects to the imap server, performs a query and returns result, e.g. a list of email, the content of an email or something else. As you probably want to use SSL, please use "imaps://" as prefix. Our examples are normally without SSL.
So for querying folders, you can simply query URL:
URL = "imap://server/"
This gives you back a result like "." and "INBOX" or other folder names.
To query list of emails, you run a custom request to fetch flags for all emails like this:
Same URL with /INBOX to specify folder and you use OptionCustomRequest with "FETCH 1:* FLAGS".
Than to query a single email, you use no custom request, but you add to URL the postfix "/INBOX/;UID=1". 1 is here the index of the email you want to query.
Now if you need to delete email, change flags or create folders, you can check the IMAP specifications and pass commands using CustomRequest option.
For next plugin version, we'll have examples showing this.