Re: [Exim] local_scan() is run before Envelope-To is set?

Top Page
Delete this message
Reply to this message
Author: Marc MERLIN
Date:  
To: Brian Kendig
CC: exim-users
Subject: Re: [Exim] local_scan() is run before Envelope-To is set?
On Sun, Oct 27, 2002 at 10:31:32PM -0500, Brian Kendig wrote:
> My problem in short: Exim sets an 'Envelope-To' header which says
> exactly what address a given email was sent to, but apparently this
> header gets set *after* local_scan() runs, so I can't have any tests


Correct.

> which check the original destination address. Is there any way to be


Yes, you can, recipients_list contains the list of recipients.

> The long of it: I'm using SA-Exim to hook SpamAssassin in to Exim, by
> replacing Exim's local_scan.c with a new one which calls SpamAssassin.
> I have a bunch of email addresses I never use any more, and I want
> SpamAssassin to notice when mail comes in for those addresses, so it
> can immediately handle them as spam. Normally this would be easy
> enough; SpamAssassin can read the 'Envelope-To' header which Exim sets.
> But my tests on this header are failing -- I think the header isn't
> set when I'm checking for it; I'm guessing it gets set somewhere later
> before the mail is delivered?


Right.

Look in my sa-exim code, where I compute mailinfo (around line 918)

    for (i=0; i < recipients_count; i++)
    {
        mailinfo=string_sprintf("%s %s", mailinfo,
            recipients_list[i].address);
    }


You probably want to create a header before you feed the mail to spamc,
around line 523:
    /* Ok, we're ready for spewing the mail at spamc */
    /* First we need to get the header lines from exim, and then we can read
       the body from fd */


This actually sounds like a good idea, so I'm going to add a X-SA-Rcpt-To:
header with the list of receipients in version 2.2

Marc
--
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems & security ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/   |   Finger marc_f@??? for PGP key