On Fri, Nov 19, 2010 at 05:30:20PM +0000, Andrew Hall wrote: > we wish to deliver the output of root's cron jobs to our noc team. we have > therefore set an entry in /etc/aliases which sends root's mail to > n...@domain.com
Presumably you are posting to this list because the systems running the cron jobs have Postfix as their MTA. > unfortunately the hosts sending the mail announce themselves as > r...@hostname.localdomain which is being rejected by our exchange server > (sender address rejected: domain not found) What you mean by "announce themselves". Do you mean the envelope sender address? > we cannot change how the servers present themselves If they are running Postfix, you definitely can, or else why come here to ask for help? Why not set "$myorigin" to a real domain? > and have no control over the exchange server. :-) > I have therefore added the following line to /etc/postfix/generic and run > postmap /etc/postfix/generic... > > /^...@.*localdomain$/ r...@domain.com Why do you expect regular expressions to work in indexed tables? Pick one or the other. Regular expression tables OR indexed tables with fixed lookup keys. In this case, since the domain will match $myorigin, fixed keys make more sense: root r...@example.com See a more complete example in http://www.postfix.org/MULTI_INSTANCE_README.html#quick > > I can check this with the following command... > > postmap -fq "r...@hostname.localdomain" regexp:/etc/postfix/generic What is the setting of smtp_generic_maps reported by "postconf -n". > > ...it does indeed attempt to get delivered to the n...@domain.com address (so > the entry in aliases is fine) but the sender does not get translated - it > still presents as "r...@hostname.localdomain" > > what am I doing wrong ? Probably using "hash:/etc/postfix/generic" in main.cf, when "regexp:" is what you tested. That said, the regexp thing is unwise, there are better ways of doing this. -- Viktor.