[Mimedefang] Global variables in filter_relay, was: Milter and aliases

Tony Nugent tony at linuxworks.com.au
Tue Oct 1 01:14:01 EDT 2002

On Mon Sep 30 2002 at 18:07, "David F. Skoll" wrote:

> On Mon, 30 Sep 2002, Aaron Paetznick wrote:
> > This brings up another question.  Should all the global variables be
> > available inside the filter_relay block?
> No, not at all.
> The built-in global variables are not available to filter_relay,
> filter_sender or filter_recipient.  $Subject can't possibly be available,
> for example, because we don't have a message yet.
> As for variables you set yourself, I posted the rules at
> http://lists.roaringpenguin.com/pipermail/mimedefang/2002-August/002034.html
> I guess it's time to put this info in the man pages. :-(


This is an FAQ because a basic understanding of the way it all flows
is vital to being able to working out what is possible, when, and

David, I'm sure you have summed it up better in other replies, this
is my interpretation of what you said in one of them (sorry, not
sure where it would be in the archives):

sequence of calling mimedefang-filter funtions:
filter_relay() filter_sender()		called after smtp MAIL FROM:
filter_recipient()			called after each RCPT TO:
filter_begin() filter() filter_end()	called in order in a single slave after smtp DATA
                                        (the others can occur in any slave)

Global variables set:			are available to functions:
---------------------			---------------------------
 outside a subroutine in the filter	all available, all the time
 in filter_relay()			may or may not
 in filter_sender()			may or may not
 in filter_recipient()			may or may not
 in filter_begin()			availaible only to filter() and filter_end()
 in filter()				availaible only to filter_end()

I had put this as a comment at the top of one of my filters a while
ago... it seems to nicely summarize how the filter works, when
variables are set and when they are subsequently visible.

If a quick wrap on the sequence of commands involved in the smtp
EHLO/HELO protocol was added to the above, then this would fill the
gap for the uninitiated :)

> Regards,
> David.


More information about the MIMEDefang mailing list