Change of domain - incoming emails for old domain

Hi,

We’re in the process of migrating our Gitlab server to a new domain, and we’re having some issues getting our Reply-To emails working as we want.

We currently have a section like the following in our config:

#### Incoming Email Address
####! The email address including the `%{key}` placeholder that will be replaced
####! to reference the item being replied to.
####! **The placeholder can be omitted but if present, it must appear in the
####!   "user" part of the address (before the `@`).**
gitlab_rails['incoming_email_address'] = "incoming+%{key}@olddomain.example.com"

If we go ahead and change it like so (which we need to):

#### Incoming Email Address
####! The email address including the `%{key}` placeholder that will be replaced
####! to reference the item being replied to.
####! **The placeholder can be omitted but if present, it must appear in the
####!   "user" part of the address (before the `@`).**
gitlab_rails['incoming_email_address'] = "incoming+%{key}@newdomain.example.com"

Then all the old reply-to & help desk email addresses people have been using for years will break.

What we really need is a way to tell Gitlab to accept and route emails for both olddomain.example.com and newdomain.example.com.

I have already got Postfix / Courier set up to accept both domains and this works without any issues, but if I drop a mail into the inbox using one of the OLD addresses, then Gitlab replies with this:

Unfortunately, your email message to GitLab could not be processed.

We couldn’t figure out what the email is for. Please create your issue or comment through the web interface.

I’ve also tried an array in gitlab_rails['incoming_email_address'] in case it was an undocumented feature, but that does not work at all.

Any ideas?

Update

This is still an issue, but I managed to create a work-around today.

The solution for me was to use Postfix canonical rewrites to edit the incoming email addresses before they reach the inbox:

sudo nano /etc/postfix/canonical

Add mapping:

@olddomain.example.com	@newdomain.example.com

Updating mapping

sudo postmap /etc/postfix/canonical

Add canonical rewrites to main.cf

sudo nano /etc/postfix/main.cf

Paste contents:

# Remap old domain
local_header_rewrite_clients = static:all
canonical_maps = hash:/etc/postfix/canonical

Reload postfix

sudo postfix reload

Once this is done, any mail sent to @olddomain.example.com lands in the correct inbox, but has it’s Delivered-To header sent to the corresponding @newdomain.example.com domain.