summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper/smtpwrapper.cpp
Side-by-side diff
Diffstat (limited to 'kmicromail/libmailwrapper/smtpwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/smtpwrapper.cpp21
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
@@ -245,5 +245,5 @@ void SMTPwrapper::connect_server()
}
}
- if (try_tls) {
+ if (result && try_tls) {
qDebug("Smpt: Try tls ");
err = start_smtp_tls();
@@ -253,4 +253,6 @@ void SMTPwrapper::connect_server()
} else {
err = mailesmtp_ehlo(m_smtp);
+ if ( err != MAILSMTP_NO_ERROR )
+ result = 0;
}
}
@@ -291,4 +293,8 @@ void SMTPwrapper::connect_server()
}
}
+ if ( result == 0 ) {
+ mailsmtp_free(m_smtp);
+ m_smtp = 0;
+ }
}
@@ -347,5 +353,9 @@ bool SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later
delete sendProgress;
sendProgress = 0;
- mailmime_free( mimeMail );
+ mailmime_free( mimeMail );
+ if ( m_smtp ) {
+ mailsmtp_free(m_smtp);
+ m_smtp = 0;
+ }
}
return result;
@@ -459,4 +469,5 @@ bool SMTPwrapper::flushOutbox() {
m_SmtpAccount->setPassword(oldPw);
}
+
KConfig cfg( locateLocal("config", "kopiemailrc" ) );
cfg.setGroup( "Status" );
@@ -468,5 +479,9 @@ bool SMTPwrapper::flushOutbox() {
sendProgress = 0;
wrap->deleteMails(mbox,mailsToRemove);
- delete wrap;
+ delete wrap;
+ if ( m_smtp ) {
+ mailsmtp_free(m_smtp);
+ m_smtp = 0;
+ }
return returnValue;
}