-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 | |||
@@ -244,7 +244,7 @@ void SMTPwrapper::connect_server() | |||
244 | failuretext = i18n("Error init SMTP connection:\n%1").arg(mailsmtpError(err)); | 244 | failuretext = i18n("Error init SMTP connection:\n%1").arg(mailsmtpError(err)); |
245 | } | 245 | } |
246 | } | 246 | } |
247 | if (try_tls) { | 247 | if (result && try_tls) { |
248 | qDebug("Smpt: Try tls "); | 248 | qDebug("Smpt: Try tls "); |
249 | err = start_smtp_tls(); | 249 | err = start_smtp_tls(); |
250 | if (err != MAILSMTP_NO_ERROR) { | 250 | if (err != MAILSMTP_NO_ERROR) { |
@@ -252,6 +252,8 @@ void SMTPwrapper::connect_server() | |||
252 | qDebug("no tls "); | 252 | qDebug("no tls "); |
253 | } else { | 253 | } else { |
254 | err = mailesmtp_ehlo(m_smtp); | 254 | err = mailesmtp_ehlo(m_smtp); |
255 | if ( err != MAILSMTP_NO_ERROR ) | ||
256 | result = 0; | ||
255 | } | 257 | } |
256 | } | 258 | } |
257 | //qDebug("mailesmtp_ehlo %d ",err ); | 259 | //qDebug("mailesmtp_ehlo %d ",err ); |
@@ -290,6 +292,10 @@ void SMTPwrapper::connect_server() | |||
290 | } | 292 | } |
291 | } | 293 | } |
292 | } | 294 | } |
295 | if ( result == 0 ) { | ||
296 | mailsmtp_free(m_smtp); | ||
297 | m_smtp = 0; | ||
298 | } | ||
293 | } | 299 | } |
294 | 300 | ||
295 | void SMTPwrapper::disc_server() | 301 | void SMTPwrapper::disc_server() |
@@ -346,7 +352,11 @@ bool SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later | |||
346 | sendProgress->hide(); | 352 | sendProgress->hide(); |
347 | delete sendProgress; | 353 | delete sendProgress; |
348 | sendProgress = 0; | 354 | sendProgress = 0; |
349 | mailmime_free( mimeMail ); | 355 | mailmime_free( mimeMail ); |
356 | if ( m_smtp ) { | ||
357 | mailsmtp_free(m_smtp); | ||
358 | m_smtp = 0; | ||
359 | } | ||
350 | } | 360 | } |
351 | return result; | 361 | return result; |
352 | } | 362 | } |
@@ -458,6 +468,7 @@ bool SMTPwrapper::flushOutbox() { | |||
458 | m_SmtpAccount->setUser(oldUser); | 468 | m_SmtpAccount->setUser(oldUser); |
459 | m_SmtpAccount->setPassword(oldPw); | 469 | m_SmtpAccount->setPassword(oldPw); |
460 | } | 470 | } |
471 | |||
461 | KConfig cfg( locateLocal("config", "kopiemailrc" ) ); | 472 | KConfig cfg( locateLocal("config", "kopiemailrc" ) ); |
462 | cfg.setGroup( "Status" ); | 473 | cfg.setGroup( "Status" ); |
463 | m_queuedMail = mailsToSend.count(); | 474 | m_queuedMail = mailsToSend.count(); |
@@ -467,6 +478,10 @@ bool SMTPwrapper::flushOutbox() { | |||
467 | delete sendProgress; | 478 | delete sendProgress; |
468 | sendProgress = 0; | 479 | sendProgress = 0; |
469 | wrap->deleteMails(mbox,mailsToRemove); | 480 | wrap->deleteMails(mbox,mailsToRemove); |
470 | delete wrap; | 481 | delete wrap; |
482 | if ( m_smtp ) { | ||
483 | mailsmtp_free(m_smtp); | ||
484 | m_smtp = 0; | ||
485 | } | ||
471 | return returnValue; | 486 | return returnValue; |
472 | } | 487 | } |