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

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Odhiambo Washington
Dátum:  
Címzett: Andreas Metzler, exim-users
Tárgy: [exim] Re: Equivalent of Envelope-to as variables in pipe transport
On Tue, Apr 23, 2024 at 8:11 PM Andreas Metzler via Exim-users <
exim-users@???> wrote:

> On 2024-04-23 Mark Hills via Exim-users <exim-users@???> wrote:
> > How do I access the equivalent of "Envelope-to" header in transport
> > variables?
>
> > I'm trying to call dovecot-lda in a manner that enables its "envelope"
> > rule.
> [...]
>
> Hello,
>
> Iirc think the easiest way to combine dovecot and exim is nowadays to
> use the LMTP server instead of dovecot-lda
>


Any ideas on how to implement the same with virtual users?

I have been using dovecot-lda successfully with virtual users with the
following transport:

dovecot_virtual_delivery:
  driver = pipe
  return_output
  command = /usr/local/libexec/dovecot/deliver -d
${extract{username}{$address_data}}
  message_suffix =
  delivery_date_add
  envelope_to_add
  return_path_add
  log_output
  user = mailnull

Now I am trying to translate the above into an lmtp delivery and I am stuck:

dovecot_virtual_delivery_lmtp:
  driver                = lmtp
  socket                = /var/run/dovecot/lmtp
  #allow suffixes/prefixes (default unset)
  rcpt_include_affixes
  #maximum number of deliveries per batch, default 1
  batch_max             = 100
  delivery_date_add
  envelope_to_add
  return_path_add
  user                  = mailnull
  group                 = mailnull

Testing the lmtp transport I get the following error:
```
This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

  save to /var/spool/virtual/domain.name/johndoe/Maildir
    generated by johndoe@???
    LMTP error after RCPT TO:</var/spool/virtual/domain.name/johndoe/Maildir

>:

    550 5.1.1 < /var/spool/virtual/domain.name/johndoe/Maildir> User
doesn't exist:
    /var/spool/virtual/domain.name/johndoe/Maildir
```

The router involved is this:
virtual_domains:
  driver            = redirect
  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}
  data              = ${extract{smtp}{$address_data}}
# 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} \
                      }
 # file_transport    = virtual_delivery
 #file_transport    = dovecot_virtual_delivery
 file_transport    = dovecot_virtual_delivery_lmtp
  reply_transport   = address_reply
  pipe_transport    = address_pipe
  retry_use_local_part
  allow_fail
  local_part_suffix = +*
  local_part_suffix_optional


-- 
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/