Bug 80747

Summary: multiple TO: fields in received mails are not displayed and are lost when replying to all
Product: [Applications] kmail Reporter: Mathieu BOIS <boism>
Component: GUIAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: allan, jork.loeser
Priority: NOR    
Version: 1.6.1   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Patch for multiple "To"-field bug against kmmessage.cpp version 1.468

Description Mathieu BOIS 2004-05-01 18:23:03 UTC
Version:           1.6.1 (using KDE 3.2 BRANCH >= 20040204, Mandrake Linux Cooker i586 - Cooker)
Compiler:          gcc version 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)
OS:          Linux (i686) release 2.6.3-4mdk

Some webmails send mails with several TO: lines (see example below). Such a webmail : http://www.laposte.net/

Example :
[...headers lines...]
From: "afriendofmine" <afriendofmineaddress@laposte.net>
To: "friend1" <friend1@domain>
To: "friend2" <friend2@domain>
To: "friend3" <friend3@domain>
Cc: "friend4" <friend4@domain>
Cc: "friend5" <friend5@domain>
Cc: "ME" <me@mydomain>
[...headers lines...]

This will be displayed in Kmail as :
From : "afriendofmine" <afriendofmineaddress@laposte.net>
To : "friend1" <friend1@domain>
CC : "friend4" <friend4@domain>, "friend5" <friend5@domain>, "ME" <me@mydomain>

And when I reply to all, it will be sent to :
To : "afriendofmine" <afriendofmineaddress@laposte.net>
CC : "friend1" <friend1@domain>, "friend4" <friend4@domain>, "friend5" <friend5@domain>, "ME" <me@mydomain>

This means that friend2 and friend3 disappear from further replys, unless I think about asking to look at all the headers and add them myself manually. It's a very annoying problem.

This problem has been in KMail for several versions, maybe from the first one.

Technically speaking, apparently it seems that the webmail does not complies to RFCs when it puts several To: lines...
But at work, with MS Outlook and Exchange server, I do not have this kind of problem...

Solution: please manage the TO: lines exactly the same way as you manage the CC: lines.

Best regards, and thanks for KMail!

Mathieu
Comment 1 Martin Ostertag 2004-05-18 16:01:58 UTC
I have the same problem here, mails are all delivered fine to recipients in the "to:" fields by the smtp-server, therefore kMail should handle that correctly.
Comment 2 Martin Ostertag 2004-05-24 17:37:16 UTC
Created attachment 6098 [details]
Patch for multiple "To"-field bug against kmmessage.cpp version 1.468

This patch solves the "To"-Field bug in the same way, as the multiple-"CC"
issue is solved; joining all the different recipients in the "To"-rfc entries.
Comment 3 Allan Beaufour 2005-04-01 12:12:46 UTC
Bonsai does the same. Anybody looking at this bug?
Comment 4 Jonathan Marten 2006-11-08 13:29:58 UTC
SVN commit 603228 by marten:

Handle multiple To header lines (not valid according to the RFCs,
but some mailers generate them...)

BUG: 80747


 M  +2 -1      branches/work/kdepim-3.5.5+/kmail/kmmessage.cpp  


--- branches/work/kdepim-3.5.5+/kmail/kmmessage.cpp #603227:603228
@@ -1849,7 +1849,8 @@
 //-----------------------------------------------------------------------------
 QString KMMessage::to() const
 {
-  return KPIM::normalizeAddressesAndDecodeIDNs( headerField("To") );
+  // handle To same as Cc below, bug 80747
+  return KPIM::normalizeAddressesAndDecodeIDNs( headerFields( "To" ).join( ", " ) );
 }
 
 
Comment 5 Jonathan Marten 2006-11-24 22:08:59 UTC
*** Bug 37018 has been marked as a duplicate of this bug. ***
Comment 6 Jonathan Marten 2006-11-26 16:53:07 UTC
SVN commit 607986 by marten:

Merge commit 603228 from branches/work/kdepim-3.5.5+:

Handle multiple To header lines (not valid according to the RFCs, 
but some mailers generate them...) 
  
CCBUG: 80747 


 M  +2 -1      kmmessage.cpp  


--- branches/KDE/3.5/kdepim/kmail/kmmessage.cpp #607985:607986
@@ -1790,7 +1790,8 @@
 //-----------------------------------------------------------------------------
 QString KMMessage::to() const
 {
-  return KPIM::normalizeAddressesAndDecodeIDNs( headerField("To") );
+  // handle To same as Cc below, bug 80747 
+  return KPIM::normalizeAddressesAndDecodeIDNs( headerFields( "To" ).join( ", " ) ); 
 }
 
 
Comment 7 Jonathan Marten 2006-11-28 14:34:44 UTC
Committed to SVN trunk as 608793 (forgot the CCBUG...)