[exim] preserving original envelope recipient in two-pass Sp…

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Sam Hathaway
Ημερομηνία:  
Προς: exim-users
Αντικείμενο: [exim] preserving original envelope recipient in two-pass SpamAssassin setup
Hello Exim users,

After reading the spec and FAQ, and searching this list, I'm still
stumped, so here goes...

I've set up SpamAssassin using a pipe transport under Exim 4.50 so
that I am able to use per-user SA settings. I used the configuration
example C047.txt[1], with the addition of passing -u $local_part to
spamc. I also have several alias files, so the recipient addresses
often end up getting rewritten before they hit the SpamAssassin router.

I've noticed that when mail is resubmitted to Exim after being
scanned, the "RCPT TO:" line is the rewritten recipient address, not
the original recipient address. So on the second pass, the original
recipient information is totally gone. This prevents my users from
filtering their mail using $original_local_part and $original_domain
in Exim filter files, or from getting useful information from
Envelope-to: headers.

I thought of adding a header like "X-Recipient-Before-Spamcheck:
$original_local_part@$original_domain" before resubmission, but that
would require my users to rewrite their filter rules. Is there any
way I can get Exim to preserve the original recipient information in
some way, so that $original_local_part and $original_domain can be
set to correct values?

Thanks for your help.
-sam, UofR.net

[1] http://exim.org/exim-html-4.50/doc/html/C047.txt

Here are the relevant configuration sections:

##### ROUTERS #####

   virtual:
     driver = redirect
     domains = +virtual_domains
     data = ${lookup{$local_part}lsearch*{/usr/cif/etc/mail_domains/ 
$domain}}
     allow_defer
     allow_fail
     forbid_file
     forbid_pipe
     no_more
     retry_use_local_part
   system_aliases:
     driver = redirect
     domains = +local_domains
     data = ${lookup{$local_part}lsearch{/etc/aliases}}
     allow_defer
     allow_fail
   spamcheck_router:
     debug_print = "R: spamcheck_router for $local_part@$domain"
     domains = +local_domains
     no_verify
     check_local_user
     local_part_suffix = +*
     local_part_suffix_optional
     condition = "${if and{{!def:h_X-Spam-Status:} \
                           {!eq{$received_protocol}{spam-scanned}}}  
{1} {0}}"
     driver = accept
     transport = spamcheck


##### TRANSPORTS #####

   spamcheck:
     driver = pipe
     command = $exim_path -oMr spam-scanned -bS
     transport_filter = /usr/bin/spamc -u $local_part -U /var/run/ 
spamd.sock
     home_directory = /tmp
     current_directory = /tmp
     user = Debian-exim
     group = Debian-exim
     use_bsmtp
     log_output
     return_fail_output