I'm trying to create a Realtime Blackhole List extension to Sieve, so I can do
stuff like this:

    require ["fileinto", "x-rbl", "x-rbl-reject"];

    if header :contains ["to","cc","bcc"] "[EMAIL PROTECTED]" {
        fileinto "INBOX";
    } elsif x-rbl :types ["127.0.0.2", "127.0.0.4", "127.0.0.5", "127.0.0.6",
                          "127.0.0.7", "127.0.0.8", "127.0.0.9"]
                  "relays.osirusoft.com" {
        x-rbl-reject :found "%i is listed on %l: %t"
                     :notfound "%i is listed on %l"
                     "relays.osirusoft.com";
    } elsif header :is "List-Post" "<mailto:[EMAIL PROTECTED]>" {
        fileinto "INBOX.lists.httpd";
    }
    ...

The "x-rbl" test should check if the SMTP client is in the given RBL domain.
The optional :types list is a list of types to block, indicated by the value
of the returned A record - if unspecified, anything with an A record at all
is blocked. (These are in <http://www.declude.com/junkmail/support/ip4r.htm>
for the curious.)

The "x-rbl-reject" command is like reject, but makes a TXT DNS query to a
RBL and supports substitutions. It uses the "found" text if the TXT record
returns a match and the "notfound" text otherwise. %i is the IP, %l is the
RBL, and %t is the value of the TXT record (nonsensical in "notfound").

My question: How do I find out the SMTP client's IP address? I hoped to see
this in the envelope stuff, but I don't. Nothing else seems to use it. I
know Postfix makes this information available in the Received: header:

    Received: from helohost (dnslookup [ip.address.literal])
            by thishost (Postfix) with ESMTP id whatever

but I do not think this is true of all servers. Should I just grab the first
"Received" header and see if the information I need is present? Should I
extend LMTP with a command to indicate the SMTP client?

Any suggestions would be appreciated.

Thanks!

--
Scott Lamb

Reply via email to