Re: [EXIM] Having a program conditionally handle mail

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Nigel Metheringham
Dátum:  
Címzett: exim-users
Tárgy: Re: [EXIM] Having a program conditionally handle mail
[Resent since originally I forgot to copy to list :-( ]

Jason,

I don't know Majordomo (expecially v2) well enough to know whether this
will do exactly what you want, but I think its probably very close to
it...

I set up a smartlist config for the exim list.  How this is done is in 
the exim FAQ - see
    http://www.exim.org/FAQ.html#SEC169


[NB this URL will change slightly when the FAQ is updated but is
currently correct - the file ref is OK, the #* bit may change]

Smartlist has a directory per list. A valid list directory has a file
called rc.init within it. A list has a list address and a list-request
address, both of which are passed to the same program, so I have a
director which picks up all valid list addresses and passes them on to
a list transport:-

     list_director:
           driver = smartuser
           suffix = -request
           suffix_optional
           except_local_parts = .bin:.etc
           require_files = /var/spool/slist/${local_part}/rc.init
           transport = list_transport


The suffix & suffix_optional parts mean that both the list and
list-request addresses are picked up. The require_files makes sure you
are looking at a valid list address (this means that as soon as you
create a list in smartlist, exim can see it with no extra config). The
except_local_parts is to make sure someone is not trying to use the
smartlist system directories....

The list transport fires off the smartlist handler program, with the
full local part (ie either list or list-request) as an argument:-

    list_transport:
           driver = pipe
           command = "/var/spool/slist/.bin/flist \
                     ${local_part}${local_part_suffix}"
           current_directory = /var/spool/slist
           home_directory = /var/spool/slist
           user = slist
           group = slist


There is nothing unusual in this config. Everything runs under the
slist user - which also needs to be a trusted user.

So that should work as a way of getting mail into the list handler.
Getting the mail from the list handler to the world is a different
problem. Smartlist (in the config we use) does this by firing up the
MTA with a long list of recipients. Majordomo I believe typically uses
an outgoing alias - or specifically builds a file with a list of
recipients.

I guess you could do something like this (untested):-
     list_exploder-director:
           condition = "${if eq {$received_protocol}{local} \
               {${if eq {$sender_ident}{majordom} \
               {true}{false}}}{false}}"
           driver = forwardfile
           suffix = -outgoing
           no_check_local_user
           except_local_parts = .bin:.etc
           file = /var/spool/majordomo/${local_part}/dist


The condition line is stolen from 
  http://www.netmaster.ca/exim/majordomo.html
and I am sure this could be done in a simpler fashion.... but I leave 
that as an exercise for the user.   I have assumed that the majordomo 
keeps the list of list members in a file called
           /var/spool/majordomo/<listname>/dist
You will need to change that name to co-incide with reality....


    Nigel.




-- 
[ Nigel Metheringham                  Nigel.Metheringham@??? ]
[ Phone: +44 1423 850000                         Fax +44 1423 858866 ]




--
*** Exim information can be found at http://www.exim.org/ ***