[Mimedefang] obtaining the senders IP address within filter_begin

Jan-Pieter Cornet johnpc at xs4all.net
Tue Jun 1 10:06:27 EDT 2010

On 2010 Jun 1, at 1:57 , David F. Skoll wrote:
>>  I see $RelayAddr as a global, but is only available in
>> _relay, _sender, and _recipient and that doesn't do me any good.
> Umm?  What makes you think it's only available there?

Probably because the docs are slightly unclear if you quick search them:

               The  IP  address of the sending relay (as a string  
consisting of
               four dot-separated  decimal  numbers.)   One   
potential  use  of
               $RelayAddr is to limit mailing to certain lists to  
people within
               your organization.  This variable is available in   
               filter_sender and filter_recipient.

That doesn't say the variable is also available in filter_begin,  
filter, filter_end, etc. That only becomes clear if you read the start  
of that section, which says:

        The following global variables are set by mimedefang.pl and  
are  avail‐
        able  for use in your filter.  All of these variables are  
always avail‐
        able to filter_begin,  filter,  filter_multipart  and   
filter_end.   In
        addition,  some of them are available in filter_relay,  
filter_sender or
        filter_recipient.  If this is the case, it will be noted below.

... but most people probably don't get that far.

The addition of the word "also" in some of the manpages might make  
things a little clearer. Or just list all functions where the variable  
is available, or say something like:

  "This variable is available in filter() and the other message body  
filtering functions, and also in filter_relay, filter_sender, ... [etc]"

And then define "message body filtering functions" somewhere in the  
start of the section to be filter_begin, filter, filter_multipart and  

(I can't recall exactly - I know I did some work on this section of  
the manpage because of the introduction of read_commands_file(), could  
be this is partly my fault).

Jan-Pieter Cornet <johnpc at xs4all.net>
Systeembeheer XS4ALL Internet bv
Internet: www.xs4all.nl
Contact: www.xs4all.nl/contact

More information about the MIMEDefang mailing list