[exim] Re: Equivalent of Envelope-to as variables in pipe tr…

Etusivu
Poista viesti
Vastaa
Lähettäjä: Odhiambo Washington
Päiväys:  
Vastaanottaja: exim-users
Aihe: [exim] Re: Equivalent of Envelope-to as variables in pipe transport
On Wed, Apr 24, 2024 at 7:26 PM Andreas Metzler via Exim-users <
exim-users@???> wrote:

> On 2024-04-24 Odhiambo Washington <odhiambo@???> wrote:
> [...]
>
> >     LMTP error after RCPT TO:</var/spool/virtual/
> domain.name/johndoe/Maildir
> [...]
> > virtual_domains:
> [...]
> >   data              = ${extract{smtp}{$address_data}}
>
> Afaict you need to modify this to return johndoe@??? instead of
> /var/spool/virtual/domain.name/johndoe/Maildir.
>


Sure. Changing that to  "data = ${extract{username}{$address_data}}" yields
johndoe@???.
But then I face the challenge of setting the appropriate transport for this
redirect router.
Looking at
https://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_redirect_router.html,
I realized that what I'm trying to do is not possible with a redirect
router.

So I created a "accept" router which works:

virtual_domains_lmtp:
  driver            = accept
  domains           = +local_domains
  condition         =  ${if < {SPAMREJECT}{1000}}
  address_data      = ${lookup mysql{ \
                      select smtp, username, users.sa_tag*10 AS sa_tag,
users.on_spamassassin AS on_spamassassin, \
                      domains.spamassassin AS spamassassin, \
                      users.uid AS uid, users.gid AS gid, users.quota AS
quota from users,domains \
                      where localpart = '${quote_mysql:$local_part}' \
                      and domain = '${quote_mysql:$domain}' \
                      and domains.enabled = '1' \
                      and users.enabled = '1' \
                      and users.domain_id = domains.domain_id}{$value}fail}
# exim4u headers_remove to remove subject if spam or X-Spam-Report if not
spam and SPAMHEADERTYPE=0.
  headers_remove    = ${if and {{

>={$acl_m_spamscore}{${extract{sa_tag}{$address_data}}}} \

                      {eq {1}{${extract{on_spamassassin}{$address_data}}}} \
                      {eq {1}{${extract{spamassassin}{$address_data}}}}} \
                      {Subject}{${if eq{SPAMHEADERTYPE}{0}{X-Spam-Report}}}
\
                      }
# exim4u headers_add to rewrite subject and set X-Spam-Report=YES if spam
and set X-Spam-Report=NO if not spam.
  headers_add       = ${if and {{ >=
{$acl_m_spamscore}{${extract{sa_tag}{$address_data}}}} \
                      {eq {1}{${extract{on_spamassassin}{$address_data}}}} \
                      {eq {1}{${extract{spamassassin}{$address_data}}}}} \
                      {X-Spam-Flag: YES\nSubject: [SPAMTAGTEXT]
$h_Subject:\n}{X-Spam-Flag: NO\n} \
                      }
  transport          = dovecot_virtual_delivery_lmtp
  retry_use_local_part
  local_part_suffix = +*
  local_part_suffix_optional



Thanks, everyone.


-- 
Best regards,
Odhiambo WASHINGTON,
Nairobi,KE
+254 7 3200 0004/+254 7 2274 3223
 In an Internet failure case, the #1 suspect is a constant: DNS.
"Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-)
[How to ask smart questions:
http://www.catb.org/~esr/faqs/smart-questions.html]


--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@???
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/