From kde-commits Sun May 16 16:36:44 2004 From: =?utf-8?q?Ingo=20Kl=C3=B6cker?= Date: Sun, 16 May 2004 16:36:44 +0000 To: kde-commits Subject: KDE_3_2_BRANCH: kdepim/kmail Message-Id: <20040516163644.90AF77AFF () office ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=108472540904957 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()) {