Re: [Exim] Re: Passing Environment Variables to a pipe [way …

Pàgina inicial
Delete this message
Reply to this message
Autor: Kirill Miazine
Data:  
A: exim-users
CC: jason
Assumptes vells: [Exim] Re: Passing Environment Variables to a pipe
Assumpte: Re: [Exim] Re: Passing Environment Variables to a pipe [way OT]
* Patrick Starrenburg [2002-11-30 15:59]:
> > >   environment = EXTENSION=${substr_1:local_part_suffix}:\
> >                                       ^ <- this should be doubled
> > >                 RECIPIENT=$local_part$local_part_suffix@$domain

> >
> > This is wrong! Better to say (note the ";" used as the list separator):
> >
> > environment = <; EXTENSION=${substr_1:$local_part_suffix} ; \
> >                  RECIPIENT=$local_part$local_part_suffix@$domain

> >
> > You're also missing the "$" in $local_part_suffix
> >
> > Besides, your transport was badly configured. environment option expects
> > a list. All colons should be doubled unless you use something else to
> > separate list items. See my example above.
>
> Hi guys
>
> If I could add some further info here. Kirill Dan is trying to get Exim,
> Procmail and TMDA working together. I didn't answer earlier because I don't
> use Procmail but I have sucessfully got Exim 4 & TMDA to work together -
> and Dan I agree there is not much info on the combination yet :-)
>
> Some points:
>
> * Dan got his environment setting from TMDA website setting for Exim
> but he did mistype one part missing a $. But my setup below, using
> same environment setting from website works fine.


The environment on the pipe transport on the TMDA website is wrong.

I suggested changing ${sg} to ${substr}, true, but of course, colon
inside ${substr} should be doubled.

> * I am interested to clarify this (also because there is not that much
> info on using Exim 4 with TMDA) the Exim spec doc says that
> environment is a string which is expanded to colon separated list of
> values so shouldn't mine below be OK? It is working correctly.


No. It is wrong. You should double the colon in ${substr}. Btw, Exim 4
sets the RECIPIENT variable itself, so no need to set that manually.

> Dan why don't you try out Exim -> TMDA functionality without procmail to see
> if it works OK then plug procmail back in? Can't help you on the procmail side
> but happy to help with Exim/TMDA.


There're some instructions on how to get procmail work with TMDA on the
TMDA website.

> Cheers
>
> PS
>
> ================================
> tmda_router:
> driver = accept
> check_local_user
> no_verify
> no_expn
> local_part_suffix = -*
> local_part_suffix_optional
> transport = tmda_pipe
>
> tmda_pipe:
>   driver = pipe
>   command = /usr/bin/python2 /usr/bin/tmda-filter
>   return_path_add
>   delivery_date_add
>   envelope_to_add
>   user = $local_part
>   group = tmda
>   environment = EXTENSION=${substr_1:$local_part_suffix}:\
>                 RECIPIENT=$local_part$local_part_suffix@$domain


Here's my router, transport at relevant part of maildrop filterfile:

<router>
forwardfile:
    driver = redirect
    domains = +local_domains
    check_local_user
    local_part_suffix = +* : -*
    local_part_suffix_optional
    file = $home/.forward
    no_verify
    check_ancestor
    hide_child_in_errmsg
    directory_transport = address_dir
    pipe_transport = address_pipe
</router>


<transport>
address_pipe:
    driver = pipe
    environment = <; EXTENSION=${substr_1:$local_part_suffix} ; \
                     DELIMITER=${substr_0_1:$local_part_suffix} ; \
                     ORIGINAL_LOCAL_PART=$original_local_part ; \
                     ORIGINAL_DOMAIN=$original_domain
    return_path_add
    envelope_to_add
    delivery_date_add
    log_output
    return_fail_output
    message_prefix =
    message_suffix =
</transport>


<mailfilter>
import SENDER;
import RECIPIENT;
import EXTENSION;

if (!$SENDER)
{
    SENDER = "<>";
}


if ($ORIGINAL_LOCAL_PART =~ /^km/)
{
    cc "|/local/tmda/bin/tmda-filter";
    if ($EXITCODE == 111)
    {
        EXITCODE = 75;
        exit;
    }
    if ($EXITCODE != 0)
    {
        EXITCODE = 0;
        exit;
    }
}


to "Maildir";
</mailfilter>

--
Kirill Miazine, Stud.Jur.                          mailto:sig@krot.org
Faculty of Law, University of Oslo                 http://km.krot.org/