So in my case, and taht is what I do with rewriting is:
Everyone, who sends emails with @from.mylocaldom is rewritten to @to.myproviderdom according the listing in a special file.
Nearly the same as you want to do. This should help to get it done.
*@tplk.loc "${extract{remote} {${lookup{$0}lsearch{/etc/exim/lokal_remote}{$value}fail}}{$value} fail}" rsfF
And the other way round. Eimails comming in ,set back to local domain:
^[a-z-0-9\.\-]+@(tropenklinik|gaestehaus-albblick)\.de "${extract{lokal} {${lookup{$0}lsearch{/etc/exim/remote_lokal}{$value}fail}}{$value} fail}" ST
EDV Daniel Müller
Leitung EDV
Tropenklinik Paul-Lechler-Krankenhaus
Paul-Lechler-Str. 24
72076 Tübingen
Tel.: 07071/206-463, Fax: 07071/206-499
Email: mueller@???
www.tropenklinik.de
www.bauen-sie-mit.tropenklinik.de
-----Ursprüngliche Nachricht-----
Von: Frank Richter [
mailto:frank.richter@hrz.tu-chemnitz.de]
Gesendet: Mittwoch, 12. Juli 2017 13:44
An: exim-users@???
Betreff: Re: [exim] Rewriting envelope from to header From
Am 12.07.2017 um 10:45 Mueller wrote:
> On the first glance:
>
> Just put a text-file in /etc/exim or where exims path is linked to
> Ex.: rewrite
>
> In rewrite : apchache@??? : remote=apache@???
> <-- first real then after remote what you want it to be In exim.conf:
>
> Rewrite Rules:
>
>
> ##mails out
> apache@??? "${extract{remote}
> {${lookup{$0}lsearch{/etc/exim/rewrite}{$value}fail}}{$value} fail}"
> rsfF
Seems to me a statical rewrite – that's not want I try to achieve.
My aim is that the envelope from (Return-Path) is set to the header from (whatever it is) for some of our webservers, where PHP programmers send email, but don't set the envelope from, so that bounces will go to apache@mydomain. They should go to the header-From …
Frank
Chemnitz University of Technology, Germany
>
> -----Ursprüngliche Nachricht-----
> Von: Frank Richter [mailto:frank.richter@hrz.tu-chemnitz.de]
> Gesendet: Mittwoch, 12. Juli 2017 09:22
> An: exim-users@???
> Betreff: [exim] Rewriting envelope from to header From
>
> Hwllo,
>
> 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}} Ffrs
>
> Sending an email with a header From: leads to this:
>
> 2017-07-12 09:10:49 Rewrite of apache@??? yielded unparseable
> address: empty address in address
>
> I tried different variations of header From, and broke the rewrite
> rule down to
>
> apache@*.mydomain $h_from: F
>
> with no success.
>
> Any ideas are welcome!
>
> Regards,
> Frank Richter
> Chemnitz University of Technology, Germany
>
>
>