summaryrefslogtreecommitdiff
path: root/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
authoralwin <alwin>2003-12-28 17:32:43 (UTC)
committer alwin <alwin>2003-12-28 17:32:43 (UTC)
commit696a2dcfcb65fbb24b709bbae0a18a7854e2d72c (patch) (side-by-side diff)
treee813c9508881796cf999e9c25c05e4482c6fd9e8 /noncore/net/mail/libmailwrapper/smtpwrapper.cpp
parentb900cad9c050c2d5963228a2191e13053457ef1d (diff)
downloadopie-696a2dcfcb65fbb24b709bbae0a18a7854e2d72c.zip
opie-696a2dcfcb65fbb24b709bbae0a18a7854e2d72c.tar.gz
opie-696a2dcfcb65fbb24b709bbae0a18a7854e2d72c.tar.bz2
reduced to the max...
- from address isn't setup any longer within the smtp account (it makes realy no sense, a smtp account describes the connection to a smtp server, not the identity of the sender) - from address is taken from the personal info of the addressbook (thats why this info exists). Of course the user can change it when sending an email. - user can select a from with a selection of the mails given in their personal infos. - in addresspicker: use "<Firstname> <Lastname>" instead of "Filename" - settings ui: switched of the part within the smtp accounts describing the identitiy of user ToDo: a dialog setting up a default signature
Diffstat (limited to 'noncore/net/mail/libmailwrapper/smtpwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.cpp54
1 files changed, 19 insertions, 35 deletions
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
index 521cd0a..30c0707 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
@@ -128,9 +128,9 @@ mailimf_fields *SMTPwrapper::createImfFields(const Mail&mail )
{
mailimf_fields *fields;
mailimf_field *xmailer;
- mailimf_mailbox *sender, *fromBox;
- mailimf_mailbox_list *from;
- mailimf_address_list *to, *cc, *bcc, *reply;
+ mailimf_mailbox *sender=0,*fromBox=0;
+ mailimf_mailbox_list *from=0;
+ mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0;
char *subject = strdup( mail.getSubject().latin1() );
int err;
@@ -167,22 +167,22 @@ mailimf_fields *SMTPwrapper::createImfFields(const Mail&mail )
return fields; // Success :)
err_free_xmailer:
- mailimf_field_free( xmailer );
+ if (xmailer) mailimf_field_free( xmailer );
err_free_fields:
- mailimf_fields_free( fields );
+ if (fields) mailimf_fields_free( fields );
err_free_reply:
- mailimf_address_list_free( reply );
- mailimf_address_list_free( bcc );
- mailimf_address_list_free( cc );
- mailimf_address_list_free( to );
+ if (reply) mailimf_address_list_free( reply );
+ if (bcc) mailimf_address_list_free( bcc );
+ if (cc) mailimf_address_list_free( cc );
+ if (to) mailimf_address_list_free( to );
err_free_from:
- mailimf_mailbox_list_free( from );
+ if (from) mailimf_mailbox_list_free( from );
err_free_fromBox:
mailimf_mailbox_free( fromBox );
err_free_sender:
- mailimf_mailbox_free( sender );
+ if (sender) mailimf_mailbox_free( sender );
err_free:
- free( subject );
+ if (subject) free( subject );
qDebug( "createImfFields - error" );
return NULL; // Error :(
@@ -206,7 +206,7 @@ mailmime *SMTPwrapper::buildTxtPart(const QString&str )
err = clist_append( content->ct_parameters, param );
if ( err != MAILIMF_NO_ERROR ) goto err_free_content;
- fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_QUOTED_PRINTABLE);
+ fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT);
if ( fields == NULL ) goto err_free_content;
txtPart = mailmime_new_empty( content, fields );
@@ -462,26 +462,6 @@ char *SMTPwrapper::getFrom( mailmime *mail )
return getFrom(ffrom);
}
-SMTPaccount *SMTPwrapper::getAccount(const QString&name )
-{
- SMTPaccount *smtp;
-
- QList<Account> list = settings->getAccounts();
- Account *it;
- for ( it = list.first(); it; it = list.next() ) {
- if ( it->getType().compare( "SMTP" ) == 0 ) {
- smtp = static_cast<SMTPaccount *>(it);
- if ( smtp->getName()== name ) {
- qDebug( "SMTPaccount found for" );
- qDebug( name );
- return smtp;
- }
- }
- }
-
- return NULL;
-}
-
void SMTPwrapper::progress( size_t current, size_t maximum )
{
if (SMTPwrapper::sendProgress) {
@@ -613,12 +593,16 @@ free_mem:
return result;
}
-void SMTPwrapper::sendMail(const Mail&mail,bool later )
+void SMTPwrapper::sendMail(const Mail&mail,SMTPaccount*aSmtp,bool later )
{
mailmime * mimeMail;
- SMTPaccount *smtp = getAccount(mail.getName());
+ SMTPaccount *smtp = aSmtp;
+ if (!later && !smtp) {
+ qDebug("Didn't get any send method - giving up");
+ return;
+ }
mimeMail = createMimeMail(mail );
if ( mimeMail == NULL ) {
qDebug( "sendMail: error creating mime mail" );