Updated the FETCH command to send the UID and SECTION parsed from the
URL. By default the BODY specifier doesn't include a section, BODY[] is
now sent whereas BODY[TEXT] was previously sent. In my opinion
retrieving just the message text is rarely useful when dealing with
emails, as the headers are required for example, so that functionality
is not retained. In can however be simulated by adding SECTION=TEXT to
the URL.
Also updated test801 and test1321 due to the BODY change.
static CURLcode imap_fetch(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
+ struct IMAP *imap = conn->data->state.proto.imap;
- /* TODO: make this select the correct mail
- * Use "1 body[text]" to get the full mail body of mail 1
- */
- result = imap_sendf(conn, "FETCH 1 BODY[TEXT]");
+ /* Send the FETCH command */
+ result = imap_sendf(conn, "FETCH %s BODY[%s]",
+ imap->uid ? imap->uid : "1",
+ imap->section ? imap->section : "");
if(result)
return result;
A001 CAPABILITY\r
A002 LOGIN user secret\r
A003 SELECT 1321\r
-A004 FETCH 1 BODY[TEXT]\r
+A004 FETCH 1 BODY[]\r
A005 LOGOUT\r
</protocol>
<proxy>
A001 CAPABILITY\r
A002 LOGIN user secret\r
A003 SELECT 801\r
-A004 FETCH 1 BODY[TEXT]\r
+A004 FETCH 1 BODY[]\r
A005 LOGOUT\r
</protocol>
</verify>