I am now trying to narrow down my rewrite. I have tried the following, based loosely on my reading of the doc section 31.11:

apache@* "${if !eq {$sender_host_address} {} \
         {apache@$1} {postmaster@$1} }"  Ffrs

I interpret the above statement to mean: if $sender_host_address is not null, (meaning the message did not originate in the local host), then rewrite headers "Ffrs" to apache@$1, otherwise (meaning the message DID originate here) rewrite those headers to postmaster@$1.

I tested with:
exim -d -v -bh 127.0.0.1 -C my.test.conf -brw apache@mydomain

Result: The indicated headers are rewritten back to the original apache!
Unless I am totally dense, 127.0.0.* is my local host. Hence, should not $sender_host_address be null? I also tried -bh with my actual server IP, with the same result.

So the question is, how do I write the condition to only rewrite those headers only for messages originated in my host? Or , perhaps the question is how do I convince exim to test as if the sender is at my host?

On 11/2/2014 1:45 PM, Phillip Carroll wrote:
OK. My understanding of the command line switches is somewhat weak.
Where the manual says "test it using -brw" I assumed that is all I
needed. That was obviously not enough.

However, it turns out adding -v -bh 127.0.0.1 to the command line got it
to recognize the rewrite rule. Which allowed me to debug my syntax.

After rereading section 31.5, I now understand the wildcarding. This now
works for me:

begin rewrite
apache@* postmaster@$1 Eh


On 11/2/2014 12:42 PM, Phillip Carroll wrote:
Several PHP scripts on my server send messages where the mail system
inserts an envelope header from apache@mydomain. I want to replace
"apache" with "postmaster" everywhere it may appear in a header. The
manual (exim-html-current) makes this sound trivial.

I have:

begin rewrite
*apache* {$1}postmaster{$2} Eh

That is it. I have nothing else I want to change.

When exim is run with -C (test config file) -brw [email protected], it
always returns "No rewrite rules are defined". If the above isn't a
rewrite rule, then I am totally lost.

I have tried several alternative rules, but no joy.

Any help appreciated.


--
## 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/

Reply via email to