diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-04-03 11:27:48 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-04-03 11:27:48 +0200 |
commit | 5392707ae331981861f74d3075307e67d4d06ba8 (patch) | |
tree | 23add1c840972babe91590ae912ba7fc3565e48f | |
parent | e291d7647d8c601b8ef7af343f9ef7f6d4c5b49c (diff) | |
download | sink-5392707ae331981861f74d3075307e67d4d06ba8.tar.gz sink-5392707ae331981861f74d3075307e67d4d06ba8.zip |
Forward the error message.
-rw-r--r-- | examples/mailtransportresource/mailtransportresource.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/examples/mailtransportresource/mailtransportresource.cpp b/examples/mailtransportresource/mailtransportresource.cpp index 516ff8e..88391a3 100644 --- a/examples/mailtransportresource/mailtransportresource.cpp +++ b/examples/mailtransportresource/mailtransportresource.cpp | |||
@@ -130,14 +130,15 @@ public: | |||
130 | options |= MailTransport::UseTls; | 130 | options |= MailTransport::UseTls; |
131 | } | 131 | } |
132 | 132 | ||
133 | SinkLog() << "Sending message " << settings.server << settings.username << "CaCert: " << settings.cacert; | 133 | SinkLog() << "Sending message " << settings.server << settings.username << "CaCert: " << settings.cacert << "Using tls: " << bool(options & MailTransport::UseTls); |
134 | SinkTrace() << "Sending message " << msg; | 134 | SinkTrace() << "Sending message " << msg; |
135 | auto result = MailTransport::sendMessage(msg, settings.server.toUtf8(), settings.username.toUtf8(), secret().toUtf8(), settings.cacert.toUtf8(), options); | 135 | auto result = MailTransport::sendMessage(msg, settings.server.toUtf8(), settings.username.toUtf8(), secret().toUtf8(), settings.cacert.toUtf8(), options); |
136 | if (!result.error) { | 136 | if (!result.error) { |
137 | SinkWarning() << "Failed to send message: " << mail << "\n" << result.errorMessage; | 137 | SinkWarning() << "Failed to send message: " << mail << "\n" << result.errorMessage; |
138 | emitNotification(Notification::Warning, ApplicationDomain::SyncError, "Failed to send message.", {}, {mail.identifier()}); | 138 | const auto errorMessage = QString("Failed to send the message: %1").arg(result.errorMessage); |
139 | emitNotification(Notification::Warning, ApplicationDomain::TransmissionError, "Failed to send message.", {}, {mail.identifier()}); | 139 | emitNotification(Notification::Warning, ApplicationDomain::SyncError, errorMessage, {}, {mail.identifier()}); |
140 | return KAsync::error("Failed to send the message."); | 140 | emitNotification(Notification::Warning, ApplicationDomain::TransmissionError, errorMessage, {}, {mail.identifier()}); |
141 | return KAsync::error(errorMessage.toUtf8().constData()); | ||
141 | } else { | 142 | } else { |
142 | emitNotification(Notification::Info, ApplicationDomain::SyncSuccess, "Message successfully sent.", {}, {mail.identifier()}); | 143 | emitNotification(Notification::Info, ApplicationDomain::SyncSuccess, "Message successfully sent.", {}, {mail.identifier()}); |
143 | emitNotification(Notification::Info, ApplicationDomain::TransmissionSuccess, "Message successfully sent.", {}, {mail.identifier()}); | 144 | emitNotification(Notification::Info, ApplicationDomain::TransmissionSuccess, "Message successfully sent.", {}, {mail.identifier()}); |