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!

mailserver setup

mysza

New version based on Debian 7.2 and with the latest Modoboa… watch this space. If you wan’t to help out testing the new guide, leave a comment below.

First off, this guide like 90% complete. If you follow it, please report back if something is wrong etc.

When I first started writing, I ran through the steps a couple of times installing everything from scratch, but after a while, I got tired of re installing just to try stuff out, so some things may gone wrong along the way.

These are mostly my own notes setting up modoboa. When completed, you’ll have postfix, dovecot and modoboa running with nginx.

I won’t go into detail how to configure the various modoboa extensions, this is covered in modoboas documentation.

I’m using a minimal install of Debian Squeeze for this. So, some packages may already be installed if you don’t us the same dist. The steps described here also should work on Ubuntu, but I haven’t verified that.

Replace <fqdn> with your fully qualified domain name. For example: mail.domain.com. <domain> with your domain. For example: example.com.

This guide assumes you’ll run mailserver, mysql and modoboa on the same host. If you plan to grow, it might be a good idea to separate these.

Fortsätt läsa ”mailserver setup”