Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Our company just switched to a new email domain and wants to keep the old domain around for a year as they notify everyone about the change. The old email domain was on Exchange 2007 and the new email domain is on Google Apps. Everyone is 100% on Google Apps, and the Exchange server just forwards on emails.

I would like to replace the Exchange server (it's underpowered and a waste of resources just forwarding emails) with something lightweight, based around Postfix or another email server. It needs to do the following:

  1. Forward emails sent to to
  2. Autoreply to the sender that everyone's email has changed to

Is this possible with Postfix, and does anyone have documentation on how to do it? I know just enough Linux to be dangerous, so I want to be sure before I suggest this.

share|improve this question
up vote 3 down vote accepted

I expect you want to fake a bounce message on the old domain. I use Exim and their is a control to do this.

You will also want a clear bounce message that indicates that the email was accepted for delivery, but future messages should be sent to the new address.

Exim also allows for custom bounce messages in the aliases file. This can be used to specify the new address.

Postfix or exchange may have similar functionality.

EDIT: Exim documentation is quite good. See the specification chapter 40 (Access Control Lists) and Chapter 11 (String Expansions) for details related to your issue.

You could try an entry in the recipient ACL something like this:

    domains =
    control == fakereject/User ${local_part} has moved \
          Your message has been forwarded to their new address.

Redirecting to your new server can be done by individual aliases, a redirect router (see chapter 22 section 3), or a rewrite rule (see chapter 31 Address rewiting) such as:

*      $     T
share|improve this answer
Do you know of any documentation on how to do this? – zippy Apr 22 '11 at 3:25

I am not sure if this is possible with Google Apps, but what I would do with a "normal" mail server is to let it handle the mails for the old domain as well, pointing the MX for the old domain to the new server and then configure the MTA accordingly.

share|improve this answer
Unfortunately, I can't do this in Google Apps without giving everyone an email address (in addition to their email address). It's way too confusing for most people unfortunately. – zippy Apr 14 '11 at 17:08

I would do that with Postfix and Cyrus-Imapd. Postfix would just forward everything to cyrus-imapd, and then you can use a Sieve Filter to :

  1. Forward the email to the new recipient
  2. Send a notification to the sender

From the top of my head, I think you could do it like that:

if header :contains "to" "" {
        redirect "";
        reject " is not used anymore, please send your emails to";

The difficulty is that Sieve rules are defined for each user, so you need to create a set of rules for each of your user. But you can easily script it.

More information about Sieve in Cyrus-Imapd can be found here:

share|improve this answer

You can use a procmail and a postfix.

share|improve this answer

Postfix can do this easily (we did something like this in postfix about 7 years ago, so I no longer have access to the very simple filter that we wrote).

I would recommend using an autoresponder (see for a few examples) to generate the the autoreply so that you can avoid all of the pitfalls in an autoreply generator.

Then, a simple filter (see for how one might implement a before-queue filter to change the destination) for the auto-forwarder.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.