So, I, ahem, ”forgot” to change sender address on one of our servers the other day which resulted in a bunch of undeliverable mails on the mailserver which got rejected because the sender domain didn’t exist anymore. This is how I fixed it.
First, I created a map file in which you map out the old wrong address and the new shiny working one as such:
then add following line to /etc/postfix/main.cf
sender_canonical_maps = hash:/etc/postfix/sender_canonical
after that reload postfix config
service postfix reload
requeue all deferred mails (or use -i to requeue specific id)
then you can flush the queue if you don’t want to wait
and voila! Now all old mails that were ”stuck” should be delivered successfully!