Bug 101190 - Kmail does redirect to sender not to specified address
Summary: Kmail does redirect to sender not to specified address
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Andreas Gungl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-09 18:09 UTC by Thomas Schwarzgruber
Modified: 2009-12-06 16:59 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
proposed fix (1.35 KB, patch)
2005-03-14 01:29 UTC, Ingo Klöcker
Details
Header of the (not yet) redirected email - patch to kmsender.cpp applied (1.23 KB, text/plain)
2005-03-15 13:16 UTC, Thomas Schwarzgruber
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Schwarzgruber 2005-03-09 18:09:11 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

When Forwarding Redirect an email it will be sent to sender not to specified "To " email address.
Comment 1 Waldo Bastian 2005-03-11 11:10:23 UTC
I think the Novell bugreport 72040 is about the same issue:

I tried to "redirect" an email.  My sending settings were incorrect,  
so the send failed, and the email was placed in "outbox" for future  
delivery.  The problem was that the email in outbox contained all of the 
original "To:", "CC", and "BCC" fields.  So, when the outgoing mail server 
settings were fixed, and the mail sent, it went out to all the original 
recipients, not the person I attempted to "redirect" to.   
 
This should be fixed somehow so that the mail is stored in "outbox"  
in such a way that when it is delivered, it only goes to the  
"redirect" recipient.

Ananlysis: The internal "X-KMail-Recipients" header is removed before sending but should be restored when sending fails, see e.g.  KMSendSMTP::send but other send() methods may be affected too.
Comment 2 Waldo Bastian 2005-03-11 11:31:48 UTC
Andreas: according to Till you are into this stuff?
Comment 3 Andreas Gungl 2005-03-12 22:59:11 UTC
Confirmed. A patch has been sent to the developer mailing list for further discussion.
Comment 4 Ingo Klöcker 2005-03-14 01:29:00 UTC
Created attachment 10096 [details]
proposed fix

Please try whether this patch fixes the problem.
Comment 5 Thomas Schwarzgruber 2005-03-14 14:38:31 UTC
I'm afraid it doesn't fix the problem .. 
It's the same as before:

My reproduction way is this:

I have an email which I got from a guy who has a kind of mailing list and who 
has the same address in HIS to line as in his sender address.
Then I try to redirect it to a good friend of mine - but I fail to 
authenticate with my pop account correctly: The mail stays in my outgoing 
folder and has as TO address the original sender address and not the TO 
address I had specified.

Additionally to that I noticed, that if I authenticate correctly to my account 
I get an error because the sender address is not mine but the original sender 
address ....
Comment 6 Ingo Klöcker 2005-03-15 01:02:02 UTC
Hmm, I guess I have to explain what redirect is supposed to do. Redirect sends the message exactly as it was received to another address. A few Resent-* headers are added to the message, but neither the To address nor the From address nor any other header is changed. This is the recommended way (as per RFC 2822) to do this.

It seems your email provider (GMX?) only allows you to send messages with your address as sender address. In this case you can't use redirect. You'll have to use forward instead. Alternatively, you can mark the message as sent and then use Send Again and change the From address.

Please, note that the fact that you can't use redirect is not due to a bug in KMail, but due to your email provider restricting which messages you are allowed to send. Maybe you can use another SMTP server instead, e.g. the SMTP server of your internet provider.
Comment 7 Thomas Schwarzgruber 2005-03-15 13:16:25 UTC
Created attachment 10125 [details]
Header of the (not yet) redirected email - patch to kmsender.cpp applied
Comment 8 Thomas Schwarzgruber 2005-03-15 13:17:11 UTC
Ok, thx for the explanation (I didn't think that the server refuses my redirection is a bug in kmail, but I thought kmail should change the "From" header to my address ..) - but does that mean that if I try to redirect, via an another smtp server, the To address wouldn't be changed but an extra header (not visible without looking at the "email-code") would be inserted and the smtp server would this header interpret correctly ?

If that's the case kmail should show the "correct" (the address that the email is really sent to..) To address when you keep your email in the outgoing folder and you edit it later ...

Well I'm really not sure if I understood that whole thing correctly - so perhaps posting the email header helps. For security reason I removed some unnecessary details and wrote a [edited] or smth. similar instead of it.   
Comment 9 Andreas Gungl 2005-03-16 21:26:52 UTC
CVS commit by gungl: 

Don't let KMail forget the "X-KMail-Recipients" header if sending
of messages failed (Patch by Ingo Klöcker)

BUGS: 101190


  M +9 -0      kmsender.cpp   1.227


--- kdepim/kmail/kmsender.cpp  #1.226:1.227
@@ -514,4 +514,7 @@ void KMSender::doSendMsgAux()
   if (!mSendProc->send(mCurrentMsg))
   {
+    mCurrentMsg->setTransferInProgress( false );
+    mOutboxFolder->unGetMsg( mFailedMessages );
+    mCurrentMsg = 0;
     cleanup();
     setStatusMsg(i18n("Failed to send (some) queued messages."));
@@ -586,4 +589,9 @@ void KMSender::slotIdle()
   if (mSendAborted) {
     // sending of message aborted
+    if ( mCurrentMsg ) {
+      mCurrentMsg->setTransferInProgress( false );
+      mOutboxFolder->unGetMsg( mFailedMessages );
+      mCurrentMsg = 0;
+    }
     msg = i18n("Sending aborted:\n%1\n"
         "The message will stay in the 'outbox' folder until you either "
@@ -598,4 +606,5 @@ void KMSender::slotIdle()
     if (!mSendProc->sendOk()) {
       mCurrentMsg->setTransferInProgress( false );
+      mOutboxFolder->unGetMsg( mFailedMessages );
       mCurrentMsg = 0;
       mFailedMessages++;
Comment 10 Andreas Gungl 2005-03-16 21:34:38 UTC
The real problem as described in comment #1 is fixed. Thanks, Ingo, for your improvement. Thomas, dealing with the SMTP server is unrelated. Thanks for reporting though, so we came across the bug in the background.
Comment 11 Ingo Klöcker 2005-03-18 00:41:16 UTC
Re #8: The SMTP server is told by KMail which address(es) the message should be sent to. The server doesn't need to parse the header.

If you edit a redirected message in the outbox then the information about the redirect address will be lost. The question is whether this is a bug or not. A redirected message should be sent as-is. It should not be editted. I think when the user tries to edit a redirected message then the dialog for the redirect address should be shown and allow the user to change this address. (Andreas, would you mind looking into this?) If the user wants to add some comments to a "redirected" message then he should forward the message.