Postfix fix wrong sender address

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:

vim /etc/postfix/sender_canonical
sender@oldomain.nx  sender@newexistingdomain.com

run

postmap /etc/postfix/sender_canonical

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)

postqueue -f

then you can flush the queue if you don’t want to wait

postfix flush

and voila! Now all old mails that were ”stuck” should be delivered successfully!

Lämna ett svar

Din e-postadress kommer inte publiceras. Obligatoriska fält är märkta *