From 31dbe72afb5e04cd86d4f107e7257fb60aaa087b Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 25 Jan 2018 14:43:07 +0100 Subject: Do the logging in the resource code. --- examples/mailtransportresource/mailtransportresource.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'examples/mailtransportresource/mailtransportresource.cpp') diff --git a/examples/mailtransportresource/mailtransportresource.cpp b/examples/mailtransportresource/mailtransportresource.cpp index 1d90adf..516ff8e 100644 --- a/examples/mailtransportresource/mailtransportresource.cpp +++ b/examples/mailtransportresource/mailtransportresource.cpp @@ -129,8 +129,12 @@ public: if (settings.server.contains("smtps")) { options |= MailTransport::UseTls; } - if (!MailTransport::sendMessage(msg, settings.server.toUtf8(), settings.username.toUtf8(), secret().toUtf8(), settings.cacert.toUtf8(), options)) { - SinkWarning() << "Failed to send message: " << mail; + + SinkLog() << "Sending message " << settings.server << settings.username << "CaCert: " << settings.cacert; + SinkTrace() << "Sending message " << msg; + auto result = MailTransport::sendMessage(msg, settings.server.toUtf8(), settings.username.toUtf8(), secret().toUtf8(), settings.cacert.toUtf8(), options); + if (!result.error) { + SinkWarning() << "Failed to send message: " << mail << "\n" << result.errorMessage; emitNotification(Notification::Warning, ApplicationDomain::SyncError, "Failed to send message.", {}, {mail.identifier()}); emitNotification(Notification::Warning, ApplicationDomain::TransmissionError, "Failed to send message.", {}, {mail.identifier()}); return KAsync::error("Failed to send the message."); -- cgit v1.2.3