Closed mbsteixeira closed 1 year ago
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; } }
Can you please create a PR for this suggestion?
Yes, after improving the code I will make the PR.
No PR to confirm the issue.
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));
};
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; } }