Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to get Exim to work in a way that it rewrites messages that stay in the LAN differently than the ones that go out to external servers.

Just rewriting every message is possible, but that would clutter messages for local use.

Internal rewrite would be

*@*.localnet xeross-mail@server01.localnet T

And outgoing would be

*@*.localnet $1.$2@valid.domain.tld

Which would result in someuser@someserver.localnet becoming someuser.someserver@valid.domain.tld?

share|improve this question
add comment

1 Answer

Not much detail in this answer sorry, but it's a start and either I'll expand it, or someone else can.

You need to modify the router which normally handles all non-local mail (dnslookup), so that it also excludes mail for other hosts inside your network. You then need to add a new router to handle that mail, and direct it at a new transport. In the new transport you could add specific rewrite rules there which then only affect internal-network mails.

Something like (untested),

router (must come before the dnslookup router so that it processes local messages first) -

mynet:
  driver = dnslookup
  domains = localnet
  transport = mynet_smtp

transports -

mynet_smtp:
  driver = smtp
  headers_rewrite = *@*.localnet xeross-mail@server01.localnet

remote_smtp:
  driver = smtp
  headers_rewrite = *@*.localnet $1.$2@valid.domain.tld
share|improve this answer
    
Unfortunately T and other envelope headers can't be changed in headers_rewrite see bottom of 7. here: exim.org/exim-html-current/doc/html/spec_html/ch31.html I've also decided to just make the sender specify a proper from instead of rewriting. Which runs just fine. Yet knowing this would still be valuable. –  Xeross Aug 5 '11 at 20:46
    
Okay, removed the T, you could still use that rule to cover the other headers I guess, but appreciate it might not fix the full problem. –  EightBitTony Aug 5 '11 at 22:45
    
Yeah the idea was to rewrite the outbound mails so they are accepted (As something@something.localnet isn't accepted usually). Another approach would be redirecting all outbound mail to a secondary exim instance and rewrite them on that. Luckily anything that does outbound mail modifies the from header itself, rather than having to rewrite it. –  Xeross Aug 6 '11 at 13:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.