cURL / Mailing Lists / curl-library / Single Mail

curl-library

Problem with imap-append example

From: Lukasz S <lukasz00031_at_wp.pl>
Date: Thu, 08 Sep 2016 08:47:48 +0200

Hi,

I write c ++ application that uses libcurl to the integration of different mailboxes. Downloading and sending mail works well, but when I want append message to a folder then the server return ok and it still waiting.

When debug flag is enabled it look like this:
> A005 APPEND INBOX.Sent (\Seen) {699}
< + OK

And after that nothing more happens. It seems like email content with some reason is not uploaded and this is the problem. I tried to load mail from the file and build in application with the same result.
I am using curl version 7.49.1. I set a breakpoint on the function assigned to CURLOPT_READFUNCTION and I know that not enter there(the same function is used when sending mail via SMTP and working properly).
I was based on the example in https://curl.haxx.se/libcurl/c/imap-append.html but changed connection_string(tested also on the same) and I had to add CURLOPT_INFILESIZE.
        
        //Base parameters
        //Importing next UID and use the SELECT INBOX.Sent
        
        curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "SELECT INBOX.Sent");
        //Select folder
        res = curl_easy_perform(curl);
        //...
        curl_easy_setopt(curl, CURLOPT_URL, connection_string);
        curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source);
        curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx);
        curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
        curl_easy_setopt(curl, CURLOPT_INFILESIZE, uploadsize);

        res = curl_easy_perform(curl);//here stop and waiting
        if (res != CURLE_OK) {
        }
        

I tried it a few days and nothing works.
If connection string looks like imap://server:port/INBOX.Sent;UID=432 it works as I mentioned above(server return ok and wait).
If you use it as in libcurl example from page(after using earlier SELECT INBOX.Sent) imap://server:port/432 it return error:
"NO Client tried to access nonexistent namespace. (Mailbox name should probably be prefixed with: INBOX.)"

I don't know that is a bug or something not mentioned in example. I will be grateful for any help.

Thanks for help!

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-09-08