Author: Marten Lehmann Date: To: exim-users Subject: Re: [exim] why multiple recipients in Envelope-To header?
Hello,
> If this option is true, an Envelope-to: header is added to the message.
> This gives the original address(es) in the incoming envelope that caused
> this delivery to happen. More than one address may be present if the
> transport is configured to handle several addresses at once, or if more
> than one original address was redirected to the same final address.
> ...
>
> If you have multiple recipients for a given message in the same domain,
> then a sending MTA usually batches them up into one session and issues
> several "MAIL TO:" commands - this is the SMTP "envelope". More than one
> recipient gives more than one entry in that additional header.
that is what I experience, but this is not what the documentation you
quoted says. My transport doesn't handle several addresses at once. The
routers route them to the correct transport and a
maildir/appendfile-transport handles message deliveries for only one
single address. And also, there are not more than one original addresses
redirected to the same final address.
> You may have to be a bit more clever with your envelope handling, by
> either refusing more than one recipient at a time (rough, slows your
> messages down) or extracting the recipients from the envelope data one
> at a time and adding the header at ACL or final transport time. How
> you'd do that is up to you, I'm afraid.
>
> Look at the "headers_add" option for transports and routers.
But with that, I wouldn't get the _original_ address of the incoming
header but only $local_part@$domain at the time of the delivery, which
may be different after an internal redirect.
From my interpretation exim is behaving wrong. envelope_to_add should
only add the address that lead to the delivery to each final mailbox,
but not all recipients from the original envelope, even ones not leading
to a delivery to this mailbox.
I just checked it again. exim really adds _all_ addresses, even if the
delivery is done to different mailboxes and different domains.