Bug 324532 - kmail filter on sending mails cannot change identity
Summary: kmail filter on sending mails cannot change identity
Alias: None
Product: kmail2
Classification: Applications
Component: general (show other bugs)
Version: 4.11.1
Platform: OpenSUSE Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: kdepim bugs
Depends on:
Reported: 2013-09-05 07:33 UTC by jos poortvliet
Modified: 2013-11-24 01:00 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.12

Filter settings screenshots (86.95 KB, image/png)
2013-09-05 07:33 UTC, jos poortvliet
What the filter looks like (28.76 KB, image/png)
2013-11-24 01:00 UTC, jos poortvliet

Note You need to log in before you can comment on or make changes to this bug.
Description jos poortvliet 2013-09-05 07:33:17 UTC
Created attachment 82173 [details]
Filter settings screenshots

I'm trying to get mails send to a certain group of addresses (anything at suse.com or suse.de, to be exact) to be send from a certain identity (SUSE, obviously). So I've configured a filter for outgoing mails, as that looks like it - see attached picture.

But it doesn't work - mails send from my other identities end up as that identity on @suse.de addresses.

A filter log on sending mail:
[09:25:42] Begin filtering on message "awesome test" from "Jos Poortvliet " at "Thursday 05 September 2013 09:25" :
[09:25:42] Evaluating filter rules: (match any of the following) "To" <contains> "suse.de" "To" <contains> "suse.com"
[09:25:42] 1 = "To" <contains> "suse.de" ('Jos Poortvliet' <jpoortvliet@suse.de>)
[09:25:42] Filter rules have matched.
[09:25:42] Applying filter action: Set Identity To "1829023743"

(the mail still ends up as send from my jospoortvliet@gmail.com address in my sent box and in my suse.de inbox)
Comment 1 Laurent Montel 2013-09-08 13:06:04 UTC
I confirm it.
Comment 2 Laurent Montel 2013-09-08 13:08:24 UTC
Ok filter just add "X-KMail-Identity" but not changed "from" "cc" "to"...
Will look at how to fix it.
Comment 3 Laurent Montel 2013-09-08 13:29:13 UTC
Git commit 6a2d349e7602753df87bdd69e34241c99185c111 by Montel Laurent.
Committed on 08/09/2013 at 13:28.
Pushed by mlaurent into branch 'KDE/4.11'.

Fix Bug 324532 - kmail filter on sending mails cannot change identity

FIXED-IN: 4.11.2

M  +18   -9    mailcommon/filter/filteractionsetidentity.cpp

Comment 4 Michael Pyne 2013-10-08 23:41:37 UTC
Please implement this feature in a way that doesn't break existing filters.

The behavior is documented at http://docs.kde.org/development/en/kdepim/kmail/filters.html, which says that "Set Identity To" should "... set the identity that will be used if you reply to this message."

In other words, it's a filter action applicable for incoming messages, not outgoing messages, at least the way that it's documented, which is used presumably to help KMail disambiguate which identity an email is intended for when it arrives over a single transport (I use this for KDE mailing list messages since @kde.org addresses automatically forward to a "real" email... without this KMail seems to pick up my actual email address in replies instead of my @kde.org address). With the current behavior every message I've received from a mailing list has been marked as From myself! ;)

However, wouldn't it already be possible to use the "Rewrite Header" filter action to rewrite the "From" header to be correct in this scenario?
Comment 5 Laurent Montel 2013-10-09 06:21:38 UTC
Git commit ec18e8b1db4c97331d5a9c123cd61ff4a101dba5 by Montel Laurent.
Committed on 09/10/2013 at 06:20.
Pushed by mlaurent into branch 'master'.

Fix apply setidentity (Bug 324532 - kmail filter on sending mails cannot change identity)
FIXED-IN: 4.12

M  +4    -2    agents/mailfilteragent/filtermanager.cpp
M  +1    -1    mailcommon/filter/filteraction.h
M  +1    -1    mailcommon/filter/filteractionaddheader.cpp
M  +1    -1    mailcommon/filter/filteractionaddheader.h
M  +1    -1    mailcommon/filter/filteractionaddtag.cpp
M  +1    -1    mailcommon/filter/filteractionaddtag.h
M  +1    -1    mailcommon/filter/filteractionaddtoaddressbook.cpp
M  +1    -1    mailcommon/filter/filteractionaddtoaddressbook.h
M  +1    -1    mailcommon/filter/filteractionbeep.cpp
M  +1    -1    mailcommon/filter/filteractionbeep.h
M  +1    -1    mailcommon/filter/filteractioncopy.cpp
M  +1    -1    mailcommon/filter/filteractioncopy.h
M  +1    -1    mailcommon/filter/filteractiondelete.cpp
M  +1    -1    mailcommon/filter/filteractiondelete.h
M  +1    -1    mailcommon/filter/filteractionexec.cpp
M  +1    -1    mailcommon/filter/filteractionexec.h
M  +1    -1    mailcommon/filter/filteractionforward.cpp
M  +1    -1    mailcommon/filter/filteractionforward.h
M  +1    -1    mailcommon/filter/filteractionmove.cpp
M  +1    -1    mailcommon/filter/filteractionmove.h
M  +1    -1    mailcommon/filter/filteractionpipethrough.cpp
M  +1    -1    mailcommon/filter/filteractionpipethrough.h
M  +1    -1    mailcommon/filter/filteractionplaysound.cpp
M  +1    -1    mailcommon/filter/filteractionplaysound.h
M  +1    -1    mailcommon/filter/filteractionredirect.cpp
M  +1    -1    mailcommon/filter/filteractionredirect.h
M  +1    -1    mailcommon/filter/filteractionremoveheader.cpp
M  +1    -1    mailcommon/filter/filteractionremoveheader.h
M  +1    -1    mailcommon/filter/filteractionreplyto.cpp
M  +1    -1    mailcommon/filter/filteractionreplyto.h
M  +1    -1    mailcommon/filter/filteractionrewriteheader.cpp
M  +1    -1    mailcommon/filter/filteractionrewriteheader.h
M  +1    -1    mailcommon/filter/filteractionsendfakedisposition.cpp
M  +1    -1    mailcommon/filter/filteractionsendfakedisposition.h
M  +1    -1    mailcommon/filter/filteractionsendreceipt.cpp
M  +1    -1    mailcommon/filter/filteractionsendreceipt.h
M  +8    -6    mailcommon/filter/filteractionsetidentity.cpp
M  +1    -1    mailcommon/filter/filteractionsetidentity.h
M  +1    -1    mailcommon/filter/filteractionsetstatus.cpp
M  +1    -1    mailcommon/filter/filteractionsetstatus.h
M  +1    -1    mailcommon/filter/filteractionsettransport.cpp
M  +1    -1    mailcommon/filter/filteractionsettransport.h
M  +1    -1    mailcommon/filter/filteractionunsetstatus.cpp
M  +1    -1    mailcommon/filter/filteractionunsetstatus.h
M  +2    -2    mailcommon/filter/mailfilter.cpp
M  +1    -1    mailcommon/filter/mailfilter.h

Comment 6 Laurent Montel 2013-10-09 06:22:09 UTC
Reverted in 4.11.3
Comment 7 jos poortvliet 2013-11-24 00:49:44 UTC
Aw, so I mis-understood what this is supposed to do... Sorry.

Will try the "Rewrite Header" solution instead.

Comment 8 jos poortvliet 2013-11-24 00:59:44 UTC
Unfortunately, that doesn't seem to work.
From is not one of the headers which can be selected in the drop-down and manually typing 'From' in the field does nothing. I attached a screenshot, perhaps I do something wrong?

It seems to happen according to the filter log:
[02:01:12] Begin filtering on message "bla" from "Jos Poortvliet " at "Sunday 24 November 2013 02:01" :
[02:01:12] Evaluating filter rules: (match any of the following) "To" <contains> "suse.de" "To" <contains> "suse.com"
[02:01:12] 1 = "To" <contains> "suse.de" (jpoortvliet@suse.de)
[02:01:12] Filter rules have matched.
[02:01:12] Applying filter action: Rewrite Header "From Jos Poortvliet <jospoortvliet@gmail.com> Jos Poortvliet <jpoortvliet@suse.de>"
Comment 9 jos poortvliet 2013-11-24 01:00:24 UTC
Created attachment 83725 [details]
What the filter looks like

I also tried a few other ways of doing it...