In postfix one can change the addresses in the header. No really news for anyone, but usually something you need when you do not expect it. This usually happens when something went wrong and a whole load of messages went out with “.local” as sender.
Postfix does this with “maps”. If you do not already have one then you generate one. So to mess with this you would use one of two maps.
Here you can do any rewrite, as the word “generic” may have already had you guessing.
here we add the following line telling postfix that there is a map we would like it to have a look at:
smtp_generic_maps = hash:/etc/postfix/generic
Obviously we now have to make that map.
The pattern is kept simple “old new”
Done with that postfix needs to map it and reload.
postmap /etc/postfix/generic postfix reload
That was it, all done. This will normally automagically pick up all the dead stuff in the que and get it routet properly. One problem (or not) with the generic map, it will translate anything that matches the pattern, sender or recipient.
If you want to be sure that only the sender gets rewritten use canoconical maps.
Works identical to the above (obviously substituting “generic” with “canoconical”.
Different is though, that the stuck messages in the que will not automagically get handled and need to be requed manually.
So try this:
postqueue -r ALL deferrer
Do realize that this is ment for accidental happenings.
Do realize that if you leave the maps in they will be used with all new messages as well.
Do realize that in some countries messing with mail is like messing with real postal letters and may not be tolerated by law.