author | alwin <alwin> | 2003-12-28 17:32:43 (UTC) |
---|---|---|
committer | alwin <alwin> | 2003-12-28 17:32:43 (UTC) |
commit | 696a2dcfcb65fbb24b709bbae0a18a7854e2d72c (patch) (side-by-side diff) | |
tree | e813c9508881796cf999e9c25c05e4482c6fd9e8 /noncore/net/mail/smtpwrapper.cpp | |
parent | b900cad9c050c2d5963228a2191e13053457ef1d (diff) | |
download | opie-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/smtpwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/smtpwrapper.cpp | 54 |
1 files changed, 19 insertions, 35 deletions
diff --git a/noncore/net/mail/smtpwrapper.cpp b/noncore/net/mail/smtpwrapper.cpp index 521cd0a..30c0707 100644 --- a/noncore/net/mail/smtpwrapper.cpp +++ b/noncore/net/mail/smtpwrapper.cpp @@ -129,7 +129,7 @@ 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; @@ -168,20 +168,20 @@ mailimf_fields *SMTPwrapper::createImfFields(const Mail&mail ) 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" ); @@ -207,5 +207,5 @@ mailmime *SMTPwrapper::buildTxtPart(const QString&str ) 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; @@ -463,24 +463,4 @@ char *SMTPwrapper::getFrom( mailmime *mail ) } -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 ) { @@ -614,10 +594,14 @@ free_mem: } -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 ) { |