On Wed, Oct 8, 2014 at 10:19 AM, krakastan <[email protected]> wrote: > thank your for your comments - i will try to digest and work through your > suggestions
They don't really apply since Nigel guessed correctly that you were talking about email routing inside of Exim. TL;DR: Add headers in the router that does the forwarding so that they get added each time it forwards. > in the meantime to clarify (i hope!).... > I have domain1.com, domain2.com and domain3.com on the same server > > [email protected] is redirected to [email protected] s > redirected to [email protected] > > The email is delivered to [email protected] has no reference to > [email protected] in the headers > > BUT IF > > domain2.com is hosted on a different server the email delivered to > [email protected] includes reference to address1 and address2 > > hope this clarifies... It does clarify things greatly. Those "redirects" are what we typically call "forwarders". You want some evidence of the chain of redirects from addr1 -> addr2 -> addr3. That can be done, but it depends how your routers are configured. Looking only at the applicable routers, my routers are configured like this: dnslookup_forwarder: driver = dnslookup domains = !+local_domains transport = remote_smtp_forwarder <snip> virtual_forwarder: driver = redirect data = LOOKUP_FORWARDER_ADDRESSES headers_add = Resent-From: $local_part@$domain headers_add = Resent-To: LOOKUP_FORWARDER_ADDRESSES headers_add = Resent-Date: $tod_full <snip> virtual_mailbox: driver = redirect data = LOOKUP_LOCAL_MAILDIR directory_transport = address_directory Then there are the two transports referenced above: remote_smtp_forwarder: driver = smtp address_directory: driver = appendfile maildir_format maildir_use_size_file maildir_tag = ,S=$message_size delivery_date_add envelope_to_add return_path_add user = MAIL_UID group = MAIL_GID quota = QUOTA_LOOKUP quota_size_regex = ,S=(\d+) quota_is_inclusive = false quota_warn_threshold = 85% In the following explanation, we are already at the point where the email has been received, it has passed reputation, spam, and virus scanning, and control is now being passed to the routers. For this example, all 3 domains are in +local_domains, because +local_domains is a SQL query that extracts information from a database. 1. When an email comes in to "addr1", it starts at the top of the routers and tests each one until it finds one that matches. It skips the first one because domain1.com is in +local_domains. It matches the second router though because addr1 is forwarded to addr2. I add 3 Resent-* headers which detail the first address getting forwarded to the second address. 2. Now that the "redirect" has occurred, Exim starts over at the top of the routers. It again skips the first one because domain2.com is in +local_domains. It matches the second router (again) because addr2 is forwarded to addr3. I add 3 more Resent-* headers which detail the second address getting forwarded to the third address. 3. Now that the "redirect" has occurred (again), Exim starts over at the top of the routers. It again skips the first one because domain3.com is in +local_domains. It skips the second router because addr3 is not configured as a forwarder. It matches the third router because addr3 is in the database as a mailbox. The "data" field is set to the full path of the user's Maildir/ and the router calls the transport "address_directory" to actually deliver the mail to the local mailbox. When you look at the delivered mail, there should be two sets of Resent-* headers: three for the first forward, and three for the second. It might initially be confusing to look at, but once you parse it mentally, it will be just like reading a map. Note: there are other routers before, during, and after the ones that I showed above. I omitted them to simplify reading so the flow from top to bottom could be easily understood. There are also other settings in each router that I omitted because it was irrelevant to the flow of the email through the routers. ...Todd -- The total budget at all receivers for solving senders' problems is $0. If you want them to accept your mail and manage it the way you want, send it the way the spec says to. --John Levine -- ## List details at https://lists.exim.org/mailman/listinfo/exim-users ## Exim details at http://www.exim.org/ ## Please use the Wiki with this list - http://wiki.exim.org/
