summaryrefslogtreecommitdiff
path: root/noncore/net
Side-by-side diff
Diffstat (limited to 'noncore/net') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.cpp24
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.h1
2 files changed, 24 insertions, 1 deletions
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
index 085d5e4..7671133 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
@@ -8,2 +8,3 @@
#include <qt.h>
+#include <qmessagebox.h>
@@ -556,2 +557,13 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) {
+void SMTPwrapper::storeFailedMail(const char*data,unsigned int size, const char*failuremessage)
+{
+ if (data) {
+ storeMail(data,size,"Sendfailed");
+ }
+ if (failuremessage) {
+ QMessageBox::critical(0,tr("Error sending mail"),
+ tr("<center>%1</center>").arg(failuremessage));
+ }
+}
+
int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMTPaccount *smtp ) {
@@ -591,2 +603,3 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMT
qDebug("Error init connection");
+ storeFailedMail(data,size,mailsmtpError(err));
result = 0;
@@ -597,2 +610,3 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMT
if ( err != MAILSMTP_NO_ERROR ) {
+ storeFailedMail(data,size,mailsmtpError(err));
result = 0;
@@ -623,4 +637,9 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMT
err = mailsmtp_auth( session, (char*)user, (char*)pass );
- if ( err == MAILSMTP_NO_ERROR )
+ if ( err == MAILSMTP_NO_ERROR ) {
qDebug("auth ok");
+ } else {
+ storeFailedMail(data,size,tr("Authentification failed"));
+ result = 0;
+ goto free_con_session;
+ }
qDebug( "Done auth!" );
@@ -628,2 +647,4 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMT
qDebug("SMTP without auth");
+ result = 0;
+ goto free_con_session;
}
@@ -632,2 +653,3 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMT
if ( err != MAILSMTP_NO_ERROR ) {
+ storeFailedMail(data,size,mailsmtpError(err));
qDebug("Error sending mail: %s",mailsmtpError(err).latin1());
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.h b/noncore/net/mail/libmailwrapper/smtpwrapper.h
index 7dcdbfd..89826d9 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.h
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.h
@@ -62,2 +62,3 @@ protected:
int sendQueuedMail(AbstractMail*wrap,SMTPaccount*smtp,RecMail*which);
+ void storeFailedMail(const char*data,unsigned int size, const char*failuremessage);