Re: [exim] Keep local_part_suffix in redirect router

Top Page
Delete this message
Reply to this message
Author: Slavko
Date:  
To: exim-users
Subject: Re: [exim] Keep local_part_suffix in redirect router
Dňa 8. novembra 2022 15:17:23 UTC používateľ Frank Richter via Exim-users <exim-users@???> napísal:
>Hello,
>
>we'd like to allow subaddresses like user+sub@domain to deliver to users’s folder sub (if existent) via lmtp. Target system is cyrus-imapd.
>We have these routers:
>
>global_aliases:
> driver = redirect
> allow_defer
> allow_fail
> data = ${lookup{$local_part@$domain}dbm{DBM/aliases}}
> local_part_suffix = "+*"
> local_part_suffix_optional
> retry_use_local_part
> no_rewrite
>


The suffix is in the $local_part_suffix variable and contains
separator already (eg. +tag). I use this:

    dovecot_ualias:
      ...
      domains = +our_domains


      local_part_suffix = +*
      local_part_suffix_optional
      qualify_preserve_domain
      data = ${lookup{$local_part} lsearch{VMAIL_DOM_DIR/$domain_data/aliases} \
             {${quote_local_part:$value$local_part_suffix}} }


I have per domain alias file with data without RHS part, thus lookup
returns only local_part, to which is suffix appended.

If your lookup returns qualified addresses, try something as this with
lookup's result (not tested):

    ${sg{$value}{\N(@[^@]+)$\N}{$local_part_suffix\$1}}


regards


--
Slavko
https://www.slavino.sk/