Bug 174942

Summary: Forwarding mails containing non-ascii characters using a filter can produce garbage
Product: [Unmaintained] kmail Reporter: Dime2 <jdv>
Component: filteringAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: lemma
Priority: NOR Keywords: triaged
Version: 1.11.1   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Original mail
Generated forward mail

Description Dime2 2008-11-12 12:40:51 UTC
Version:           1.9.9 (using KDE 3.5.9)
OS:                Linux
Installed from:    Fedora RPMs

If I received the 8bit message and try to formad it manually (inline forwarding), it is working the best.
But if I use filters for forwarding, kmail sumit the message as 7bin only in 99% cases
Plus, before beginning of the oroginal message it is added the garbage symbols. If message didn't have html then forwarding produced without content but with the carbage symbols only.
Comment 1 Michael Leupold 2009-03-15 13:08:57 UTC
I can reproduce this behaviour using the following instructions:
1. Add a new incoming mail filter.
2. Set it to forward messages to another account
3. Send yourself a mail that triggers this filter. Add non-ascii characters (eg. chinese, cyrillic, ...) and let KMail choose the encoding automatically.
4. Wait for the message to be sent and forwarded using the filter.

Result: The original message displays correctly. The forwarded message is displayed encoded. It actually looks as if the encoded mime-part was inlined without adding appropriate mime-headers (original message encoded using base64, forwarded mail is sent as 7bit).
Comment 2 Michael Leupold 2009-03-15 13:12:39 UTC
Created attachment 32132 [details]
Original mail

This is the original mail I sent.
(shadowed email addresses, message-id and removed part of the route)
Comment 3 Michael Leupold 2009-03-15 13:13:18 UTC
Created attachment 32133 [details]
Generated forward mail

This is the forward that was generated by the filter.
(shadowed email addresses, message-id and removed part of the route)
Comment 4 Thomas McGuire 2009-03-17 14:59:07 UTC
SVN commit 940441 by tmcguire:

Don't produce garbage when forwarding a mail with a filter.

For this, I had to remove the code duplication in KMFilterActionForward::process()
and use KMMessage::createForward() instead.

This uncovered a bug in createForward (content type boundary was not saved) and a
small bug in the template parser.

Also, I added a KMMessage::dump() function to help with debugging mimelib 
related troubles.

Not perfect yet, the way the template parser copies the message needs to be
improved, right now, when forwarding a signed message, the signed text gets
replaced with the template text, resulting in an invalid signature ...

BUG: 174942


 M  +11 -72    kmfilteraction.cpp  
 M  +44 -7     kmmessage.cpp  
 M  +22 -1     kmmessage.h  
 M  +1 -0      templateparser.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=940441
Comment 5 Thomas McGuire 2009-03-18 10:32:24 UTC
SVN commit 940772 by tmcguire:

Backport r940441 by tmcguire from trunk to the 4.2 branch:

Don't produce garbage when forwarding a mail with a filter.

For this, I had to remove the code duplication in KMFilterActionForward::process()
and use KMMessage::createForward() instead.

This uncovered a bug in createForward (content type boundary was not saved) and a
small bug in the template parser.

Also, I added a KMMessage::dump() function to help with debugging mimelib 
related troubles.

Not perfect yet, the way the template parser copies the message needs to be
improved, right now, when forwarding a signed message, the signed text gets
replaced with the template text, resulting in an invalid signature ...

CCBUG: 174942



 M  +11 -72    kmfilteraction.cpp  
 M  +44 -7     kmmessage.cpp  
 M  +22 -1     kmmessage.h  
 M  +1 -0      templateparser.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=940772