[exim] headers_remove before userforward transport

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Adnan Vatandas
Fecha:  
A: exim-users
Asunto: [exim] headers_remove before userforward transport
Hello,

is it possible to remove a header entry in a mail before it gets
transported?

I want to remove a header entry before the mail gets processed by the
users .forward file respectively the transport that parses this
file. The idea is to check in a mySQL database if the user added the
originating address in his webmail's whitelist, and depending on this
condition the mails X-MailScanner-SpamScore header is removed or not so
the .forward file of users who have whitelisted the sender ignores the
mail (we have a script in webmail where users can define the spamscore
for filtering and generate the appropriate entry in the .forward file).

SpamAssassin checks incoming mail for spam, adds header entry and
passes the mail on to exim -> exim looks up if originating address is on
users webmail whitelist, if true, the header entry gets removed ->
users .forward file sorts mail depending on X-SpamScore header, but
if it's whitelisted and exim removed the SpamScore header, the mail
won't be sorted out and is delivered to the users inbox

I added the mySQL-query as condition for header removal of the
userforward router, but the .forward file is processed before header
removal, as headers_remove becomes not active at routing but at
transport time.

2 routers are added in the file in the following order, one with and one
without the header removal. The first contains the condition when to
become active.

userforward_spamwhitelist:
driver = redirect
allow_filter
check_ancestor
check_local_user
condition = ${lookup mysql{the query}}
no_expn
file = $home/.forward
headers_remove = X-MailScanner-SpamScore
file_transport = address_file
pipe_transport = address_pipe
reply_transport = address_reply
no_verify

userforward:
driver = redirect
allow_filter
check_ancestor
check_local_user
no_expn
file = $home/.forward
file_transport = address_file
pipe_transport = address_pipe
reply_transport = address_reply
no_verify


The log sais:
--------> userforward_spamwhitelist router <--------
[..]
mySQL lookup yielded: 1
calling userforward_spamwhitelist router
[..]

but doesn't do anything, except telling local_delivery to remove the
header line _after_ parsing .forward, which isn't what I want.

>>>>>>>>>>>>>>>> Local deliveries >>>>>>>>>>>>>>>>

[..]
removed header line:
X-MailScanner-SpamScore: sssssss
[..]


Suggestions appreciated :-)

sincerely
Adnan Vatandas