-rw-r--r-- | kmicromail/libmailwrapper/smtpwrapper.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/kmicromail/libmailwrapper/smtpwrapper.cpp b/kmicromail/libmailwrapper/smtpwrapper.cpp index 872a460..845c71c 100644 --- a/kmicromail/libmailwrapper/smtpwrapper.cpp +++ b/kmicromail/libmailwrapper/smtpwrapper.cpp @@ -246,3 +246,3 @@ void SMTPwrapper::connect_server() } - if (try_tls) { + if (result && try_tls) { qDebug("Smpt: Try tls "); @@ -254,2 +254,4 @@ void SMTPwrapper::connect_server() err = mailesmtp_ehlo(m_smtp); + if ( err != MAILSMTP_NO_ERROR ) + result = 0; } @@ -292,2 +294,6 @@ void SMTPwrapper::connect_server() } + if ( result == 0 ) { + mailsmtp_free(m_smtp); + m_smtp = 0; + } } @@ -348,3 +354,7 @@ bool SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later sendProgress = 0; - mailmime_free( mimeMail ); + mailmime_free( mimeMail ); + if ( m_smtp ) { + mailsmtp_free(m_smtp); + m_smtp = 0; + } } @@ -460,2 +470,3 @@ bool SMTPwrapper::flushOutbox() { } + KConfig cfg( locateLocal("config", "kopiemailrc" ) ); @@ -469,3 +480,7 @@ bool SMTPwrapper::flushOutbox() { wrap->deleteMails(mbox,mailsToRemove); - delete wrap; + delete wrap; + if ( m_smtp ) { + mailsmtp_free(m_smtp); + m_smtp = 0; + } return returnValue; |