diff options
Diffstat (limited to 'examples/mailtransportresource/mailtransport.cpp')
-rw-r--r-- | examples/mailtransportresource/mailtransport.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/examples/mailtransportresource/mailtransport.cpp b/examples/mailtransportresource/mailtransport.cpp index 49d858e..5985562 100644 --- a/examples/mailtransportresource/mailtransport.cpp +++ b/examples/mailtransportresource/mailtransport.cpp | |||
@@ -58,7 +58,7 @@ static size_t payload_source(void *ptr, size_t size, size_t nmemb, void *userp) | |||
58 | } | 58 | } |
59 | 59 | ||
60 | 60 | ||
61 | void sendMessageCurl(const char *to[], int numTos, const char *cc[], int numCcs, const char *msg, bool useTls, const char* from, const char *username, const char *password, const char *server, bool verifyPeer) | 61 | bool sendMessageCurl(const char *to[], int numTos, const char *cc[], int numCcs, const char *msg, bool useTls, const char* from, const char *username, const char *password, const char *server, bool verifyPeer) |
62 | { | 62 | { |
63 | //For ssl use "smtps://mainserver.example.net | 63 | //For ssl use "smtps://mainserver.example.net |
64 | const char* cacert = 0; // = "/path/to/certificate.pem"; | 64 | const char* cacert = 0; // = "/path/to/certificate.pem"; |
@@ -121,15 +121,17 @@ void sendMessageCurl(const char *to[], int numTos, const char *cc[], int numCcs, | |||
121 | } | 121 | } |
122 | curl_slist_free_all(recipients); | 122 | curl_slist_free_all(recipients); |
123 | curl_easy_cleanup(curl); | 123 | curl_easy_cleanup(curl); |
124 | return res == CURLE_OK; | ||
124 | } | 125 | } |
126 | return false; | ||
125 | } | 127 | } |
126 | 128 | ||
127 | }; | 129 | }; |
128 | 130 | ||
129 | void MailTransport::sendMessage(const KMime::Message::Ptr &message, const QByteArray &server, const QByteArray &username, const QByteArray &password, const QByteArray &cacert) | 131 | bool MailTransport::sendMessage(const KMime::Message::Ptr &message, const QByteArray &server, const QByteArray &username, const QByteArray &password, const QByteArray &cacert) |
130 | { | 132 | { |
131 | QByteArray msg = message->encodedContent(); | 133 | QByteArray msg = message->encodedContent(); |
132 | qWarning() << "Sending message " << msg; | 134 | qDebug() << "Sending message " << msg; |
133 | 135 | ||
134 | QByteArray from(message->from(true)->mailboxes().isEmpty() ? QByteArray() : message->from(true)->mailboxes().first().address()); | 136 | QByteArray from(message->from(true)->mailboxes().isEmpty() ? QByteArray() : message->from(true)->mailboxes().first().address()); |
135 | QList<QByteArray> toList; | 137 | QList<QByteArray> toList; |
@@ -155,6 +157,5 @@ void MailTransport::sendMessage(const KMime::Message::Ptr &message, const QByteA | |||
155 | cc[i] = ccList.at(i); | 157 | cc[i] = ccList.at(i); |
156 | } | 158 | } |
157 | 159 | ||
158 | sendMessageCurl(to, numTos, cc, numCcs, msg, useTls, from.isEmpty() ? nullptr : from, username, password, server, verifyPeer); | 160 | return sendMessageCurl(to, numTos, cc, numCcs, msg, useTls, from.isEmpty() ? nullptr : from, username, password, server, verifyPeer); |
159 | qWarning() << "Message sent"; | ||
160 | } | 161 | } |