I have an internal machine which sends out newsletters for customers. The software that's doing it is defaulting the envelope sender to $USER@$HOSTNAME. It's in the process of being fixed, but in the meantime, I wrote a couple of quick macros to set the return path (rewriting the envelope sender). It works for all successful sends, and most bounces. However there are a few bounces that don't seem to ever get to the router because there is some basic thing wrong with the email being sent (example below is a domain which exists but MX is misconfigured, probably intentionally).
1. Successful sends and bounces for legit local and remote domains get return path set properly. 2. Generic failures such as MX ends up with NSDOMAIN or points to IP don't get return path set properly. 3. rewrite rule which rewrites www@internal_host_names to [email protected] *always* work properly. 4. This could also be something in my configs doing this, pipe up if it looks obvious to you that's what is happening. If I could get the rewrite rules (essentially sets $sender_address from my understanding) to expand the macro shown below, I think I would be golden, but in my testing it didn't work. In anybody's authoritative opinion, should it work and I just did not test properly? Or is that strictly static mappings, and not expandable (or I'm accessing variables that aren't yet set)? =================begin bounce quote ========== [email protected] all relevant MX records point to non-existent hosts ------ This is a copy of the message, including all the headers. ------ Return-path: <[email protected]> Received: from ivut53.ivenue.net by m.ivenue.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.74) (envelope-from <[email protected]>) id 1Pp3Bv-0004CS-07 for [email protected]; Mon, 14 Feb 2011 18:30:33 +0000 ================end bounce quote =========== ================begin exim.conf quote =========== HDR_RETURN_PATH = ${lc:${addresses:>, $h_from:}} DFLT_RETURN_PATH = ${if eq{HDR_RETURN_PATH}{} {$sender_address}{HDR_RETURN_PATH}} SET_WWW_RETURN_PATH = ${if eq{${lc:$sender_address_local_part}}{www} {DFLT_RETURN_PATH}{$sender_address} } router--- dnslookup_iv_hosts: debug_print = "Router: dnslookup_iv_hosts for $local_part@$domain" driver = dnslookup domains = ! +local_domains transport = remote_smtp_iv_hosts condition = ${if eq {$acl_c_iv}{1} {yes}{no} } errors_to = SET_WWW_RETURN_PATH no_more cannot_route_message = Domain of sender ($domain) not found in DNS transport--- remote_smtp_iv_hosts: debug_print = "Transport: remote_smtp_iv_hosts for $local_part@$domain" driver = smtp max_rcpt = 10 hosts_max_try = 2 return_path = SET_WWW_RETURN_PATH # ivwm51-local.ivenue.net interface = 10.1.2.201 helo_data = "out.system.iv.ivenue.com" .include_if_exists /etc/exim/dkim_transports.conf rewrite--- www@*.ivenue.net [email protected] E =================end exim.conf quote ======== -- Regards... Todd I seek the truth...it is only persistence in self-delusion and ignorance that does harm. -- Marcus Aurealius -- ## List details at http://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/
