Loading ...
Sorry, an error occurred while loading the content.

274378Re: virtual_alias_maps and X-Original-To

Expand Messages
  • Wietse Venema
    Feb 18, 2011
    • 0 Attachment
      Adam Hamer:
      [ Charset ISO-8859-1 unsupported, converting... ]
      >
      >
      >
      > > Aliasing via virtual(5) is brutally efficient. No content modification,
      > > just message routing, so the header is not added.
      > >
      > > To add an X-Original-Recipient header, messages to multiple recipients
      > > have to be split into one copy per-recipient since the header you want
      > > is recipient-specific.
      > >
      > > Since the queue file contains a single copy of the message for all
      > > recipients, such rewriting *cannot* happen on input, it can only happen on
      > > output via a delivery agent that is processing a single recipient. This
      > > means you need a custom transport for this destination that processes
      > > mail one recipient at a time and prepends the header.
      > >
      > > This can be done via an external program via pipe(8) or by modifying the
      > > source code of the smtp(8) delivery agent so that the header is added when
      > > a suitable boolean flag is set and the message has exactly one recipient.
      > >
      > > The pipe(8) approach would then re-submit the mail for outbound delivery
      > > to a different Postfix instance to avoid loops.
      > >
      > > --
      > > Viktor.
      >
      > ??Thanks again Viktor.
      > It sounds a bit more in depth than I was hoping for. Given the _only_ func
      >-tion for this alias is to forward to one address, would it be possible to do
      >- a simpler approach??

      If it is only for one special case,

      /etc/postfix/main.cf
      smtpd_recipient_restrictions =
      permit_mynetworks
      ...
      reject_unauth_destination
      ...
      check_recipient_access hash:/etc/postfix/recipient_access

      /etc/postfix/recipient_access:
      user@... PREPEND: X-Original-To: username@...

      If it is for EXIM emulation:

      /etc/postfix/main.cf
      smtpd_recipient_restrictions =
      permit_mynetworks
      ...
      reject_unauth_destination
      ...
      check_recipient_access pcre:/etc/postfix/recipient_access.pcre

      /etc/postfix/recipient_access.pcre:
      /(.+)/ PREPEND: X-Envelope-To: $1

      Either way, if mail has multiple recipients, then they will see
      the prepended message header.

      Wietse
    • Show all 11 messages in this topic