curl-library
curl IMAP mailbox atom special
Date: Mon, 27 Apr 2015 15:53:55 +0200
Hi @ all,
I've an issue with libcurl's IMAP especially with mailbox names who
have atom-special ( RFC 3501 atom-specials = SP ( ) { \ CTL
list-wildcards DQUOTE ) .
They need to be represented as quoted string or literal.
How can i append mails to this mailboxes ? E.g: A001 APPEND
"atom{specialfolder" {123} .. I tried the following:
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <curl.h>
int main(void)
{
FILE * fp = fopen ("/tmp/test.eml", "r");
fseek(fp, 0, SEEK_END);
unsigned long fsize = ftell(fp);
rewind(fp);
CURL *curl = curl_easy_init();
CURLcode res = CURLE_OK;
if(curl) {
curl_easy_setopt(curl ,CURLOPT_INFILESIZE_LARGE, fsize);
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
//curl_easy_escape("atom{specialfolder");
curl_easy_setopt(curl, CURLOPT_URL,
"imaps://192.168.122.2/atom%7Bspecialfolder");
curl_easy_setopt(curl, CURLOPT_READDATA,fp);
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
fclose(fp);
return (int)res;
}
Output:
...
A002 OK Logged in
A003 APPEND atom{specialfolder (\Seen) {4263}
A003 BAD Error in IMAP command APPEND: Invalid characters in atom
AND
...
//curl_easy_escape("\"atom{specialfolder\"");
curl_easy_setopt(curl, CURLOPT_URL,
"imaps://192.168.122.2/%22atom%7Bspecialfolder%22");
..
Output:
...
A002 OK Logged in
A003 APPEND \"atom{specialfolder\" (\Seen) {4263}
A003 BAD Error in IMAP command APPEND: Invalid characters in atom
Thanks for help!
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-04-27