Am 13.07.2017 um 00:50 schrieb Heiko Schlittermann via Exim-users:
Hi,Frank Richter <[email protected]> (Mi 12 Jul 2017 15:46:31 CEST): …From: Frank Richter I'd like to rewrite envelope from "apache@*.mydomain" to the address in header From. I tried it according to https://github.com/Exim/exim/wiki/Q0801 with this rewrite rule: apache@*.mydomain ${sg{$h_from:}{^.*<(.*)>}{\$1}} Ffrsseems complicated. Lena's approach is better (using the ${address:…} operator.
Yes, thanks for this.
According to https://www.exim.org/exim-html-current/doc/html/spec_html/ch-address_rewriting.html (untested): apache@*.mydomain ${address:$rh_from:} F I suspect that the wiki page is wrong, but I'm not sure.Unfortunately, this doesn't work either. Same error message: Rewrite of [email protected] yielded unparseable address: empty address in address I'm sendig with: swaks --to ... --from [email protected] --server ... --data /tmp/mailThe rules from the rewrite section are applied at the time the message is receveived (as written in the spec file). So, at the time the envelope gets rewritten, the $h_from: isn't set yet.
Ok, that's true. So I guess, it should be added to https://github.com/Exim/exim/wiki/Q0801
Probably you need to rewrite at transport time. But … the envelope sender can't be rewritten at transport time, transports have a "return_path" option for modification of the envelope sender.
Your and Jeremy's and Jan's comments lead me to this:
begin transports
…
smtp:
driver = smtp
return_path = ${if and {{match {$return_path}{^apache@.*\.tu-chemnitz\.de\$}}\
{match
{${domain:${address:$h_from:}}}{.*\.tu-chemnitz\.de\$}}}\
{${address:$h_from:}}fail}
I tried some cases and abuse scenarios - it works as aspected: Rewrite
Envelope From, if the header From: is a local address.
Would it be possible to check the domain with a defined domainlist?But anyway, I'll try to expand the test to check, if header From: is a valid local address.
Many thanks, Frank Chemnitz University of Technology, Germany
smime.p7s
Description: S/MIME Cryptographic Signature
-- ## 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/
