CVS commit by kloecker: Several people reported bugs with sending because they didn't specify their email address for the default identity. This patch tells those people about their error (yes, it introduces a new string, but IMO an untranslated error message is better than no error message especially because this 'bug' is reported repeatedly (e.g. 53448, 78895, 80817, 81611 and many more)). Moreover the From header will be set to the email address of the message's identity or the default identity. So in case the user sets the email address for his identities the messages will get sent. M +29 -4 kmsender.cpp 1.197.2.5 --- kdepim/kmail/kmsender.cpp #1.197.2.4:1.197.2.5 @@ -355,4 +355,29 @@ kdDebug(5006) << "KMSender::doSendMsg() // See if there is another queued message mCurrentMsg = kmkernel->outboxFolder()->getMsg(mFailedMessages); + if ( mCurrentMsg && !mCurrentMsg->transferInProgress() && + mCurrentMsg->sender().isEmpty() ) { + // if we do not have a sender address then use the email address of the + // message's identity or of the default identity unless those two are also + // empty + const KMIdentity & id = kmkernel->identityManager() + ->identityForUoidOrDefault( mCurrentMsg->headerField( "X-KMail-Identity" ).stripWhiteSpace().toUInt() ); + if ( !id.emailAddr().isEmpty() ) { + mCurrentMsg->setFrom( id.fullEmailAddr() ); + } + else if ( !kmkernel->identityManager()->defaultIdentity().emailAddr().isEmpty() ) { + mCurrentMsg->setFrom( kmkernel->identityManager()->defaultIdentity().fullEmailAddr() ); + } + else { + KMessageBox::sorry( 0, i18n( "It's not possible to send messages " + "without specifying a sender address.\n" + "Please set the email address of " + "identity '%1' in the Identities " + "section of the configuration dialog " + "and then try again." ) + .arg( id.identityName() ) ); + kmkernel->outboxFolder()->unGetMsg( mFailedMessages ); + mCurrentMsg = 0; + } + } if (!mCurrentMsg || mCurrentMsg->transferInProgress()) {