mailio icon indicating copy to clipboard operation
mailio copied to clipboard

imap::append failing

Open mbsteixeira opened this issue 3 years ago • 2 comments

Mail message method ::append operation fails when there are attached files. I implemented the move_message function using the "COPY " statement. It is horrible, but it runs ok for my purpose.

void imap::move_message(const std::string& folder_from_name, const std::string& folder_dest_name, const std::string& mail_id) { int tryCm1 = 1; select(folder_from_name); string cmd1 = "COPY " + mail_id + " " + folder_dest_name; string cmd2 = "COPY " + mail_id + " INBOX." + folder_dest_name; retry_oper: _dlg->send(format(tryCm1==1? cmd1 : cmd2));

string line = _dlg->receive();
tag_result_response_t parsed_line = parse_tag_result(line);
if (parsed_line.result == tag_result_response_t::OK)
{
    _dlg->send(format("CLOSE"));
    string line = _dlg->receive();
    tag_result_response_t parsed_line = parse_tag_result(line);
    return;
}
if (tryCm1 == 1)
{
    tryCm1 = 2;
    goto retry_oper;
}
_dlg->send(format("CLOSE"));
throw imap_error("Parsing failure."+ parsed_line.response);

};

I added these two changes, too : void message::subject_charset( const std::string& charset) { _subject.charset = charset;

}

void message::subject(const string& mail_subject) { _subject.buffer = mail_subject; if (_subject.charset == codec::CHARSET_ASCII) { _subject.charset = codec::CHARSET_ASCII; if (codec::is_utf8_string(_subject.buffer)) _subject.charset = codec::CHARSET_UTF8; } }

mbsteixeira avatar Sep 07 '22 15:09 mbsteixeira

Can you please create a PR for this suggestion?

karastojko avatar Sep 14 '22 18:09 karastojko

Yes, after improving the code I will make the PR.

mbsteixeira avatar Sep 14 '22 20:09 mbsteixeira

No PR to confirm the issue.

karastojko avatar Dec 04 '22 20:12 karastojko