@@ -961,7 +961,6 @@ int SMTPClientBase::setMailBody(const Message &pMsg) {
961961 std::ostringstream body_ss;
962962 body_ss << " --sep\r\n Content-Type: " << pMsg.getMimeType () << " ; charset=UTF-8\r\n\r\n " << pMsg.getBody () << " \r\n " ;
963963 std::string body_real = body_ss.str ();
964- addCommunicationLogItem (body_real.c_str ());
965964
966965 // If there's attachments, prepare the attachments text content
967966 Attachment** arr_attachment = pMsg.getAttachments ();
@@ -982,18 +981,21 @@ int SMTPClientBase::setMailBody(const Message &pMsg) {
982981 }
983982 int body_part_ret_code = (*this .*sendCommandPtr)(body_real.substr (index_start, length).c_str (), CLIENT_SENDMAIL_BODYPART_ERROR);
984983 if (body_part_ret_code != 0 ) {
984+ addCommunicationLogItem (body_real.c_str ());
985985 return body_part_ret_code;
986986 }
987987 }
988988 } else {
989989 int body_ret_code = (*this .*sendCommandPtr)(body_real.c_str (), CLIENT_SENDMAIL_BODY_ERROR);
990990 if (body_ret_code != 0 ) {
991+ addCommunicationLogItem (body_real.c_str ());
991992 return body_ret_code;
992993 }
993994 }
995+ addCommunicationLogItem (body_real.c_str ());
994996
995997 // End of data
996- std::string end_data_command { " \r\n .\r\n " };
998+ std::string end_data_command { " \r\n --sep-- \r\n .\r\n " };
997999 addCommunicationLogItem (end_data_command.c_str ());
9981000 int end_data_ret_code = (*this .*sendCommandWithFeedbackPtr)(end_data_command.c_str (), CLIENT_SENDMAIL_END_DATA_ERROR, CLIENT_SENDMAIL_END_DATA_TIMEOUT);
9991001 if (end_data_ret_code != STATUS_CODE_REQUESTED_MAIL_ACTION_OK_OR_COMPLETED) {
@@ -1061,7 +1063,7 @@ std::string SMTPClientBase::createAttachmentsText(const std::vector<Attachment*>
10611063 delete[] b64;
10621064 }
10631065 }
1064- retval += " \r\n --sep-- " ;
1066+ retval += " \r\n " ;
10651067 return retval;
10661068}
10671069
0 commit comments