author | zautrix <zautrix> | 2005-03-10 21:14:19 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-10 21:14:19 (UTC) |
commit | 6e3c3178fa8e0c421753c08506b4a91bbcecc26f (patch) (side-by-side diff) | |
tree | ff9c2b22376e71e135f59154c6aeeb8ed95f10ce | |
parent | 3a1891136e7b1290a6b3ddd573a863e51bd3047b (diff) | |
download | kdepimpi-6e3c3178fa8e0c421753c08506b4a91bbcecc26f.zip kdepimpi-6e3c3178fa8e0c421753c08506b4a91bbcecc26f.tar.gz kdepimpi-6e3c3178fa8e0c421753c08506b4a91bbcecc26f.tar.bz2 |
smtp ompi fix
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 5 | ||||
-rw-r--r-- | kmicromail/editaccounts.cpp | 24 | ||||
-rw-r--r-- | kmicromail/libetpan/tools/mailstream_socket.c | 2 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/smtpwrapper.cpp | 8 |
4 files changed, 25 insertions, 14 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 5661955..65f9168 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt @@ -1,119 +1,124 @@ Info about the changes in new versions of KDE-Pim/Pi ********** VERSION 2.0.15 ************ PwM/Pi: Added keyboard shorcuts for - toggling summary view (space bar) - delete item (delete + backspace key) - add new item ( i + n key) Fixed length of info in the title. KO/Pi-KA/Pi: Changed "ME" menu bar entry to an icon. KO/Pi: Fixed two minor bugs in displaying todos. If in month view a cell is selected, the key shortcut "d" shows now that date. Added complete info for a todo in month view as an icon left of the text. Fixed problems of displaying data when "<" or ">" were used in summary/location/description. Fixed problem of search dialog size when switching displays. Cancel key now closes date picker. Rearranged KO/Pi file menu structure. +OM/Pi: +Added to the SMTP account setting the option +"No secure connection". +You have to configure your SMTP accounts again, sorry. + ********** VERSION 2.0.14 ************ Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. Fixed bug in KO/Pi todo printing. Made Qtopia calendar import possible on desktop . ********** VERSION 2.0.13 ************ Fixed a problem in the addressee select dialog and made it more user friendly by adding a minimize splitter. In the search dialog you can switch now the focus from search line edit to the list view by pressing key "arrow down". OM/Pi: Fixed a refresh problem of outgoing/sent/sendfailed folders after sending mails. Added missing German translation. Added warning if path is specified in local folder settings of account config. ********** VERSION 2.0.12 ************ KO/Pi: Fixed a bug in todo start/due date handling for non recurring todos with a start and due date. Fixed some layout problems in the KO/Pi agenda view when there were many conflicting itmes. Fixed several problems of the keyboard focus in the desktop versions when opening the search dialog/event viewer. Fixed problem in pi-sync mode when wrong password was sent. OM/Pi: Fixed a crash when displaying mails with "Show mail as html" was checked in the config. Added a check before displaying the mail if the mail is in html format, if "Show mail as html" is enabled. ********** VERSION 2.0.11 ************ Fixed some problems in pi-sync mode (e.g. details of events were not synced properly) ********** VERSION 2.0.10 ************ KO/Pi: In the desktop versions the context menu in the search dialog was broken after introducing the What'sThis info for the list view. This is fixed. Changed the search dialog a bit to make it more user friendly. (E.g.: Removed message box about "no items found" and set key focus to search line edit after search). Added config option to hide the week number in KO/Pi toolbar. ********** VERSION 2.0.9 ************ Made month view icons for multiday events a bit nicer. Some minor fixes in KO/Pi (e.g. go to today did not work for new week view properly). ********** VERSION 2.0.8 ************ Fixed a problem in dependency info in the ipk files for the Zaurus. Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar. Added a "go today" button to the datepicker. Added "created" and "last modified" to event/todo viewer (and What'sThis viewer) and made it configureable to show these values. Fixed a problem for events (from external iCal files) that do have a duration but no end date. ********** VERSION 2.0.7 ************ Added global application font settings (for all KDE-Pim/Pi apps) to the general settings. Fixed a problem in OM/Pi when trying to login to some IMAP servers (like the IMAP server of Apple: mail.mac.com ) Added recurring todos to KO/Pi. ********** VERSION 2.0.6 ************ Some bugfixes in the pi-sync mode. Added German translation for pi-sync mode. KO/Pi: Made the todolist using alternate background. Other minor fixes in KO/Pi. ********** VERSION 2.0.5 ************ Bugfixes in KO/Pi. ********** VERSION 2.0.4 ************ diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp index f1075c0..49049f6 100644 --- a/kmicromail/editaccounts.cpp +++ b/kmicromail/editaccounts.cpp @@ -237,368 +237,372 @@ void EditAccounts::slotEditMail() } void EditAccounts::slotDeleteMail() { if ( !mailList->currentItem() ) { QMessageBox::information( this, i18n( "Error" ), i18n( "<p>Please select an account.</p>" ), i18n( "Ok" ) ); return; } Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); slotDeleteAccount( a ); } void EditAccounts::slotNewNews() { slotNewAccount( "NNTP" ); } void EditAccounts::slotEditNews() { if ( !newsList->currentItem() ) { QMessageBox::information( this, i18n( "Error" ), i18n( "<p>Please select an account.</p>" ), i18n( "Ok" ) ); return; } Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); slotEditAccount( a ); } void EditAccounts::slotDeleteNews() { if ( !newsList->currentItem() ) { QMessageBox::information( this, i18n( "Error" ), i18n( "<p>Please select an account.</p>" ), i18n( "Ok" ) ); return; } Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); slotDeleteAccount( a ); } void EditAccounts::slotAdjustColumns() { int currPage = configTab->currentPageIndex(); configTab->showPage( mailTab ); mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 ); mailList->setColumnWidth( 1, 50 ); configTab->showPage( newsTab ); newsList->setColumnWidth( 0, newsList->visibleWidth() ); configTab->setCurrentPage( currPage ); } void EditAccounts::accept() { settings->saveAccounts(); QDialog::accept(); } /** * SelectMailType */ SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags ) : SelectMailTypeUI( parent, name, modal, flags ) { selected = selection; selected->replace( 0, selected->length(), typeBox->currentText() ); connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) ); } void SelectMailType::slotSelection( const QString &sel ) { selected->replace( 0, selected->length(), sel ); } /** * IMAPconfig */ IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) : IMAPconfigUI( parent, name, modal, flags ) { data = account; - fillValues(); + //fillValues(); connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); ComboBox1->insertItem( "Only if available", 0 ); ComboBox1->insertItem( "Always, Negotiated", 1 ); ComboBox1->insertItem( "Connect on secure port", 2 ); ComboBox1->insertItem( "Run command instead", 3 ); CommandEdit->hide(); - ComboBox1->setCurrentItem( data->ConnectionType() ); + fillValues(); + // ComboBox1->setCurrentItem( data->ConnectionType() ); } void IMAPconfig::slotConnectionToggle( int index ) { if ( index == 2 ) { portLine->setText( IMAP_SSL_PORT ); } else if ( index == 3 ) { portLine->setText( IMAP_PORT ); CommandEdit->show(); } else { portLine->setText( IMAP_PORT ); } } void IMAPconfig::fillValues() { accountLine->setText( data->getAccountName() ); serverLine->setText( data->getServer() ); portLine->setText( data->getPort() ); ComboBox1->setCurrentItem( data->ConnectionType() ); userLine->setText( data->getUser() ); passLine->setText( data->getPassword() ); prefixLine->setText(data->getPrefix()); localFolder->setText( data->getLocalFolder() ); int max = data->getMaxMailSize() ; if ( max ) { CheckBoxDown->setChecked( true ); SpinBoxDown->setValue ( max ); } else { CheckBoxDown->setChecked( false ); SpinBoxDown->setValue ( 5 ); } CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); } void IMAPconfig::accept() { if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) { QMessageBox::information( this, i18n( "Error" ), i18n( "No paths allowed in\nlocal folder settings.\nPlease specify a folder\nname or leave empty\nto create local folder\nwith account name\nautomatically." ), i18n( "Ok" ) ); return; } data->setAccountName( accountLine->text() ); data->setServer( serverLine->text() ); data->setPort( portLine->text() ); data->setConnectionType( ComboBox1->currentItem() ); data->setUser( userLine->text() ); data->setPassword( passLine->text() ); data->setPrefix(prefixLine->text()); data->setLocalFolder( localFolder->text() ); data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); QDialog::accept(); } /** * POP3config */ POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) : POP3configUI( parent, name, modal, flags ) { data = account; - fillValues(); + //fillValues(); connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); ComboBox1->insertItem( "Only if available", 0 ); ComboBox1->insertItem( "Always, Negotiated", 1 ); ComboBox1->insertItem( "Connect on secure port", 2 ); ComboBox1->insertItem( "Run command instead", 3 ); CommandEdit->hide(); - ComboBox1->setCurrentItem( data->ConnectionType() ); + fillValues(); + //ComboBox1->setCurrentItem( data->ConnectionType() ); } void POP3config::slotConnectionToggle( int index ) { // 2 is ssl connection if ( index == 2 ) { portLine->setText( POP3_SSL_PORT ); } else if ( index == 3 ) { portLine->setText( POP3_PORT ); CommandEdit->show(); } else { portLine->setText( POP3_PORT ); } } void POP3config::fillValues() { accountLine->setText( data->getAccountName() ); serverLine->setText( data->getServer() ); portLine->setText( data->getPort() ); ComboBox1->setCurrentItem( data->ConnectionType() ); userLine->setText( data->getUser() ); passLine->setText( data->getPassword() ); localFolder->setText( data->getLocalFolder() ); int max = data->getMaxMailSize() ; if ( max ) { CheckBoxDown->setChecked( true ); SpinBoxDown->setValue ( max ); } else { CheckBoxDown->setChecked( false ); SpinBoxDown->setValue ( 5 ); } CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); } void POP3config::accept() { if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) { QMessageBox::information( this, i18n( "Error" ), i18n( "No paths allowed in\nlocal folder settings.\nPlease specify a folder\nname or leave empty\nto create local folder\nwith account name\nautomatically." ), i18n( "Ok" ) ); return; } data->setAccountName( accountLine->text() ); data->setServer( serverLine->text() ); data->setPort( portLine->text() ); data->setConnectionType( ComboBox1->currentItem() ); data->setUser( userLine->text() ); data->setPassword( passLine->text() ); data->setLocalFolder( localFolder->text() ); data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); QDialog::accept(); } /** * SMTPconfig */ SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) : SMTPconfigUI( parent, name, modal, flags ) { data = account; connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); - fillValues(); + // fillValues(); QIconSet icon; //icon = SmallIcon("fileexport"); icon = SmallIcon("fileopen"); SignaturButton->setText(""); SignaturButton->setIconSet (icon ) ; SignaturButton->setMaximumSize ( SignaturButton->sizeHint().height()+4,SignaturButton->sizeHint().height()) ; connect( SignaturButton, SIGNAL( clicked() ), this, SLOT( chooseSig() ) ); connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); - ComboBox1->insertItem( "Only if available", 0 ); - ComboBox1->insertItem( "Always, Negotiated", 1 ); - ComboBox1->insertItem( "Connect on secure port", 2 ); - ComboBox1->insertItem( "Run command instead", 3 ); + ComboBox1->insertItem( "No secure connection, no TLS", 0 ); + ComboBox1->insertItem( "Only if available, try TLS", 1 ); + ComboBox1->insertItem( "Always, use TLS", 2 ); + ComboBox1->insertItem( "Connect on secure port (SSL)", 3 ); + ComboBox1->insertItem( "Run command instead", 4 ); CommandEdit->hide(); - ComboBox1->setCurrentItem( data->ConnectionType() ); + fillValues(); + //ComboBox1->setCurrentItem( data->ConnectionType() ); } void SMTPconfig::chooseSig() { QString lnk = KFileDialog::getOpenFileName( "", "Choose Signatur File", this ); if ( !lnk.isEmpty() ) { SignaturEdit->setText( lnk ); } } void SMTPconfig::slotConnectionToggle( int index ) { // 2 is ssl connection if ( index == 2 ) { portLine->setText( SMTP_SSL_PORT ); } else if ( index == 3 ) { portLine->setText( SMTP_PORT ); CommandEdit->show(); } else { portLine->setText( SMTP_PORT ); } } void SMTPconfig::fillValues() { accountLine->setText( data->getAccountName() ); serverLine->setText( data->getServer() ); portLine->setText( data->getPort() ); ComboBox1->setCurrentItem( data->ConnectionType() ); loginBox->setChecked( data->getLogin() ); userLine->setText( data->getUser() ); passLine->setText( data->getPassword() ); SignaturEdit->setText( data->getSigFile() ); } void SMTPconfig::accept() { data->setAccountName( accountLine->text() ); data->setServer( serverLine->text() ); data->setPort( portLine->text() ); data->setConnectionType( ComboBox1->currentItem() ); data->setLogin( loginBox->isChecked() ); data->setUser( userLine->text() ); data->setPassword( passLine->text() ); data->setSigFile( SignaturEdit->text() ); QDialog::accept(); } /** * NNTPconfig */ NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) : NNTPconfigUI( parent, name, modal, flags ) { data = account; connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) ); connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) ); fillValues(); connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); } void NNTPconfig::slotShowSub() { save(); data->save(); ListViewGroups->clear(); for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { QCheckListItem *item; item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); item->setOn( true ); } topLevelWidget()->setCaption( i18n("%1 groups subscribed").arg( subscribedGroups.count())); } void NNTPconfig::slotShowFilter() { save(); data->save(); ListViewGroups->clear(); int count = 0; for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { QCheckListItem *item; if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) { item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); ++count; if ( subscribedGroups.contains( (*it) ) >= 1 ) { item->setOn( true ); diff --git a/kmicromail/libetpan/tools/mailstream_socket.c b/kmicromail/libetpan/tools/mailstream_socket.c index 04a6f48..fd2c758 100644 --- a/kmicromail/libetpan/tools/mailstream_socket.c +++ b/kmicromail/libetpan/tools/mailstream_socket.c @@ -113,134 +113,134 @@ mailstream_low * mailstream_low_socket_open(int fd) return s; free_socket_data: socket_data_free(socket_data); err: return NULL; } static int mailstream_low_socket_close(mailstream_low * s) { struct mailstream_socket_data * socket_data; socket_data = (struct mailstream_socket_data *) s->data; socket_data_close(socket_data); return 0; } static void mailstream_low_socket_free(mailstream_low * s) { struct mailstream_socket_data * socket_data; socket_data = (struct mailstream_socket_data *) s->data; socket_data_free(socket_data); s->data = NULL; free(s); } static int mailstream_low_socket_get_fd(mailstream_low * s) { struct mailstream_socket_data * socket_data; socket_data = (struct mailstream_socket_data *) s->data; return socket_data->fd; } static ssize_t mailstream_low_socket_read(mailstream_low * s, void * buf, size_t count) { struct mailstream_socket_data * socket_data; socket_data = (struct mailstream_socket_data *) s->data; /* timeout */ { fd_set fds_read; fd_set fds_excp; struct timeval timeout; int r; timeout = mailstream_network_delay; FD_ZERO(&fds_read); FD_SET(socket_data->fd, &fds_read); FD_ZERO(&fds_excp); FD_SET(socket_data->fd, &fds_excp); // LUTZ for safety I insert here a max val as well if ( timeout.tv_sec > DEFAULT_NETWORK_TIMEOUT ) timeout.tv_sec = DEFAULT_NETWORK_TIMEOUT; r = select(socket_data->fd + 1, &fds_read, NULL, &fds_excp, &timeout); if (r < 1 ) return -1; if (FD_ISSET(socket_data->fd, &fds_excp)) return -1; if (!FD_ISSET(socket_data->fd, &fds_read)) return 0; } return recv(socket_data->fd,buf,count,MSG_NOSIGNAL); //return read(socket_data->fd, buf, count); } #include <stdio.h> static ssize_t mailstream_low_socket_write(mailstream_low * s, const void * buf, size_t count) { struct mailstream_socket_data * socket_data; socket_data = (struct mailstream_socket_data *) s->data; /* timeout */ { fd_set fds_write; fd_set fds_excp; struct timeval timeout; int r; timeout = mailstream_network_delay; FD_ZERO(&fds_write); FD_SET(socket_data->fd, &fds_write); FD_ZERO(&fds_excp); FD_SET(socket_data->fd, &fds_excp); // LUTZ next line blocks sometimes if ( timeout.tv_sec > DEFAULT_NETWORK_TIMEOUT ) timeout.tv_sec = DEFAULT_NETWORK_TIMEOUT; - fprintf(stderr,"fd %d to secs %d \n", socket_data->fd, timeout.tv_sec ); + //fprintf(stderr,"fd %d to secs %d \n", socket_data->fd, timeout.tv_sec ); r = select(socket_data->fd + 1, NULL, &fds_write, &fds_excp, &timeout); if (r < 1) return -1; if (FD_ISSET(socket_data->fd, &fds_excp)) return -1; if (!FD_ISSET(socket_data->fd, &fds_write)) return 0; } return send(socket_data->fd,buf,count,MSG_NOSIGNAL); //return write(socket_data->fd, buf, count); } /* mailstream */ mailstream * mailstream_socket_open(int fd) { mailstream_low * low; mailstream * s; low = mailstream_low_socket_open(fd); if (low == NULL) goto err; s = mailstream_new(low, 8192); if (s == NULL) goto free_low; return s; free_low: mailstream_low_close(low); err: return NULL; } diff --git a/kmicromail/libmailwrapper/smtpwrapper.cpp b/kmicromail/libmailwrapper/smtpwrapper.cpp index 5096f67..872a460 100644 --- a/kmicromail/libmailwrapper/smtpwrapper.cpp +++ b/kmicromail/libmailwrapper/smtpwrapper.cpp @@ -100,205 +100,207 @@ void SMTPwrapper::progress( size_t current, size_t maximum ) { } void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) { if (!mail) return; QString localfolders = AbstractMail::defaultLocalfolder(); AbstractMail*wrap = AbstractMail::getWrapper(localfolders); wrap->createMbox(box); wrap->storeMessage(mail,length,box); delete wrap; } bool SMTPwrapper::smtpSend( mailmime *mail,bool later) { clist *rcpts = 0; char *from, *data; size_t size; from = data = 0; mailmessage * msg = 0; msg = mime_message_init(mail); mime_message_set_tmpdir(msg,getenv( "HOME" )); int r = mailmessage_fetch(msg,&data,&size); mime_message_detach_mime(msg); mailmessage_free(msg); if (r != MAIL_NO_ERROR || !data) { if (data) free(data); qDebug("Error fetching mime... "); return false; } msg = 0; if (later) { storeMail(data,size,"Outgoing"); if (data) free( data ); KConfig cfg( locateLocal("config", "kopiemailrc" ) ); cfg.setGroup( "Status" ); cfg.writeEntry( "outgoing", ++m_queuedMail ); emit queuedMails( m_queuedMail ); return true; } from = getFrom( mail ); rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); bool result = smtpSend(from,rcpts,data,size); if (data) { free(data); } if (from) { free(from); } if (rcpts) smtp_address_list_free( rcpts ); return result; } void SMTPwrapper::storeFailedMail(const char*data,unsigned int size, const char*failuremessage) { if (data) { storeMail(data,size,"Sendfailed"); } if (failuremessage) { QMessageBox::critical(0,i18n("Error sending mail"), failuremessage); } } int SMTPwrapper::start_smtp_tls() { if (!m_smtp) { return MAILSMTP_ERROR_IN_PROCESSING; } int err = mailesmtp_starttls(m_smtp); if (err != MAILSMTP_NO_ERROR) return err; mailstream_low * low; mailstream_low * new_low; low = mailstream_get_low(m_smtp->stream); if (!low) { return MAILSMTP_ERROR_IN_PROCESSING; } int fd = mailstream_low_get_fd(low); if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) { mailstream_low_free(low); mailstream_set_low(m_smtp->stream, new_low); } else { return MAILSMTP_ERROR_IN_PROCESSING; } return err; } void SMTPwrapper::connect_server() { QString server, user, pass; bool ssl; uint16_t port; ssl = false; - bool try_tls = true; + bool try_tls = false; bool force_tls=false; QString failuretext = ""; if (m_smtp || !m_SmtpAccount) { return; } server = m_SmtpAccount->getServer(); - if ( m_SmtpAccount->ConnectionType() == 2 ) { + if ( m_SmtpAccount->ConnectionType() == 3 ) { ssl = true; try_tls = false; - } else if (m_SmtpAccount->ConnectionType() == 1) { + } else if (m_SmtpAccount->ConnectionType() == 2) { force_tls = true; + } else if (m_SmtpAccount->ConnectionType() == 1) { + try_tls = true; } int result = 1; port = m_SmtpAccount->getPort().toUInt(); m_smtp = mailsmtp_new( 20, &progress ); if ( m_smtp == NULL ) { /* no failure message cause this happens when problems with memory - than we we can not display any messagebox */ return; } int err = MAILSMTP_NO_ERROR; ; // odebug << "Servername " << server << " at port " << port << "" << oendl; if ( ssl ) { qDebug("smtp: ssl_connect "); err = mailsmtp_ssl_connect( m_smtp, server.latin1(), port ); } else { ; // odebug << "No SSL session" << oendl; err = mailsmtp_socket_connect( m_smtp, server.latin1(), port ); } if ( err != MAILSMTP_NO_ERROR ) { qDebug("Error init SMTP connection" ); failuretext = i18n("Error init SMTP connection:\n%1").arg(mailsmtpError(err)); result = 0; } qDebug("SMTP connection inited "); /* switch to tls after init 'cause there it will send the ehlo */ if (result) { err = mailsmtp_init( m_smtp ); if (err != MAILSMTP_NO_ERROR) { result = 0; qDebug("Error init SMTP connection "); failuretext = i18n("Error init SMTP connection:\n%1").arg(mailsmtpError(err)); } } if (try_tls) { qDebug("Smpt: Try tls "); err = start_smtp_tls(); if (err != MAILSMTP_NO_ERROR) { try_tls = false; qDebug("no tls "); } else { err = mailesmtp_ehlo(m_smtp); } } //qDebug("mailesmtp_ehlo %d ",err ); if (!try_tls && force_tls) { result = 0; failuretext = i18n("Error init SMTP tls:%1").arg(mailsmtpError(err)); } if (result==1 && m_SmtpAccount->getLogin() ) { ; // odebug << "smtp with auth" << oendl; if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) { // get'em LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true ); login.show(); if ( QDialog::Accepted == login.exec() ) { // ok user = login.getUser(); pass = login.getPassword(); } else { result = 0; failuretext=i18n("Login aborted - \nstoring mail to localfolder"); } } else { user = m_SmtpAccount->getUser(); pass = m_SmtpAccount->getPassword(); } ; // odebug << "session->auth: " << m_smtp->auth << "" << oendl; if (result) { err = mailsmtp_auth( m_smtp, (char*)user.latin1(), (char*)pass.latin1() ); if ( err == MAILSMTP_NO_ERROR ) { qDebug("Smtp authentification ok "); } else { failuretext = i18n("Authentification failed"); result = 0; } } } } void SMTPwrapper::disc_server() { if (m_smtp) { mailsmtp_quit( m_smtp ); mailsmtp_free( m_smtp ); m_smtp = 0; } } int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size ) { int err,result; |