0

I have to all my invalid incoming to new addresss I have a route like this.

virtual_aliases:
    driver = redirect
    allow_defer
    allow_fail
    domains = lsearch;/etc/userdomains
    user = "${lookup \
        {$domain} \
        lsearch{/etc/userdomains} \
        {$value} \
    }"
    group = "${lookup \
        {$domain} \
        lsearch{/etc/userdomains} \
        {$value} \
    }"
    address_data = \
        "router=$router_name \
        redirect=${quote:${lookup \
            {$local_part} \
            lsearch{${extract{5}{::}{${lookup passwd{${lookup{$domain}lsearch{/etc/userdomains}{$value}}}{$value}}}}/etc/${perl{untaint}{$domain}}/aliases} \
    }}"
    data = ${extract{redirect}{$address_data}}
    file_transport = address_file
    router_home_directory = ${extract \
        {5} \
        {::} \
        {${lookup passwd \
            {${lookup \
                {$domain_data} \
                lsearch{/etc/userdomains} \
                {$value} \
            }} \
            {$value} \
        }} \
    }
    local_part_suffix = +*
    local_part_suffix_optional
    retry_use_local_part
    unseen


userforward:
    driver = redirect
    allow_filter
    allow_fail
    forbid_filter_run
    forbid_filter_perl
    forbid_filter_lookup
    forbid_filter_readfile
    forbid_filter_readsocket
    check_ancestor
    check_local_user
    domains = $primary_hostname
    no_expn
    require_files = "+$home/.forward"
    condition = "${extract{size}{${stat:$home/.forward}}}"
    file = $home/.forward
    file_transport = address_file
    reply_transport = address_reply
    directory_transport = address_directory
    user = $local_part_data
    group = $local_part_data
    no_verify

File as user: redirect@domain.com , user *: ::fail:Any Message

Here my normal forward works but not this * one

Lacek
  • 7,233
  • 24
  • 28
be MrZulf
  • 101
  • 2

2 Answers2

0

just use nwildlsearch instead of lsearch and put the * entry at the bottom of the file.

Jasen
  • 826
  • 6
  • 12
0

It should be like this.

catchall:
    driver = redirect
    domains = lsearch;/etc/userdomains
    address_data = \
        "router=$router_name \
        redirect=${quote:${lookup \
            {invalid_accept} \
            lsearch{${extract{5}{::}{${lookup passwd{${lookup{$domain}lsearch{/etc/userdomains}{$value}}}{$value}}}}/etc/${perl{untaint}{$domain}}/aliases} \
    }}"
    data = ${extract{redirect}{$address_data}}
    allow_fail

It is the perfect way and in a file it should be like this

invalid_accept : :fail:Whatever act you want I shown here failed act
Gerald Schneider
  • 23,274
  • 8
  • 57
  • 89
be MrZulf
  • 101
  • 2