-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.cpp | 24 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.h | 1 |
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 @@ | |||
8 | #include <qt.h> | 8 | #include <qt.h> |
9 | #include <qmessagebox.h> | ||
9 | 10 | ||
@@ -556,2 +557,13 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) { | |||
556 | 557 | ||
558 | void SMTPwrapper::storeFailedMail(const char*data,unsigned int size, const char*failuremessage) | ||
559 | { | ||
560 | if (data) { | ||
561 | storeMail(data,size,"Sendfailed"); | ||
562 | } | ||
563 | if (failuremessage) { | ||
564 | QMessageBox::critical(0,tr("Error sending mail"), | ||
565 | tr("<center>%1</center>").arg(failuremessage)); | ||
566 | } | ||
567 | } | ||
568 | |||
557 | int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMTPaccount *smtp ) { | 569 | 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 | |||
591 | qDebug("Error init connection"); | 603 | qDebug("Error init connection"); |
604 | storeFailedMail(data,size,mailsmtpError(err)); | ||
592 | result = 0; | 605 | result = 0; |
@@ -597,2 +610,3 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMT | |||
597 | if ( err != MAILSMTP_NO_ERROR ) { | 610 | if ( err != MAILSMTP_NO_ERROR ) { |
611 | storeFailedMail(data,size,mailsmtpError(err)); | ||
598 | result = 0; | 612 | result = 0; |
@@ -623,4 +637,9 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMT | |||
623 | err = mailsmtp_auth( session, (char*)user, (char*)pass ); | 637 | err = mailsmtp_auth( session, (char*)user, (char*)pass ); |
624 | if ( err == MAILSMTP_NO_ERROR ) | 638 | if ( err == MAILSMTP_NO_ERROR ) { |
625 | qDebug("auth ok"); | 639 | qDebug("auth ok"); |
640 | } else { | ||
641 | storeFailedMail(data,size,tr("Authentification failed")); | ||
642 | result = 0; | ||
643 | goto free_con_session; | ||
644 | } | ||
626 | qDebug( "Done auth!" ); | 645 | qDebug( "Done auth!" ); |
@@ -628,2 +647,4 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMT | |||
628 | qDebug("SMTP without auth"); | 647 | qDebug("SMTP without auth"); |
648 | result = 0; | ||
649 | goto free_con_session; | ||
629 | } | 650 | } |
@@ -632,2 +653,3 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size, SMT | |||
632 | if ( err != MAILSMTP_NO_ERROR ) { | 653 | if ( err != MAILSMTP_NO_ERROR ) { |
654 | storeFailedMail(data,size,mailsmtpError(err)); | ||
633 | qDebug("Error sending mail: %s",mailsmtpError(err).latin1()); | 655 | 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: | |||
62 | int sendQueuedMail(AbstractMail*wrap,SMTPaccount*smtp,RecMail*which); | 62 | int sendQueuedMail(AbstractMail*wrap,SMTPaccount*smtp,RecMail*which); |
63 | void storeFailedMail(const char*data,unsigned int size, const char*failuremessage); | ||
63 | 64 | ||