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

I am trying to set up mail forwarding on a new server of mine. For example, I want to forward all email sent to it to, say, I do not need/want to be able to send mail from mydomain.

I'm running Ubuntu 10.04 and it's my server so I have root access and can install/modify anything necessary. I have a few years of Linux experience, but never played with mail servers before so I literally know nothing about them. Hence, I can't really understand all the questions that have been previously asked about this topic. There also seems to be many different answers given and it would take forever to read about every solution proposed. That being said, can anyone point me in the right direction on how to accomplish this? Thank you!

share|improve this question
up vote 11 down vote accepted

I prefer postfix, it's easier to configure and by default, most things are turned off:

  1. Install postfix.
  2. In /etc/postfix/ set these two options

    mydomain =
    mydestination =

    Replace "" with your actual domain. This is very important

  3. Optionally in, set myhostname to something appropriate (could also be "")
  4. Add this line somewhere in

    local_transport = error:local delivery is disabled

    this turns off local transport so email delivery to local users are turned off (you can skip this is you want local users to receive email).

  5. In, make sure you have this line (there should be lots of variations that have been commented out):

    alias_maps = hash:/etc/aliases # (or `hash:/etc/mail/aliases`, etc.)
  6. Now edit the /etc/aliases (or /etc/mail/aliases or whatever it was in and create the alias: emailaddress:, this will make it so incoming email for "" get forwarded to ""

  7. Save and run this command: postalias /etc/aliases (or /etc/mail/aliases or whatever it was in
  8. Start postfix: sudo /etc/init.d/postfix start

Here is some more info for postfix on ubuntu:

share|improve this answer
Sounds pretty easy as well. I will update once my DNS admin getting the MX record needed. – shanet Nov 8 '11 at 6:09
Yeah, I forgot to mention that you need to point your domain's MX record to this server. – Jon Lin Nov 8 '11 at 6:14
After failing to get sendmail working correctly, I tried using Postfix with your directions. It's working beautifully now. Thank you! – shanet Nov 9 '11 at 1:37
I'm getting Recipient address rejected: local delivery is disabled – iLoveUnicorns Feb 1 at 17:46

Do you already have a functioning incoming mail server? Have you setup MX records for you domain yet?

  • Set up mx records in DNS
  • Install sendmail

Set up /etc/mail/virtusertable with the following forwarding line:
share|improve this answer
That simple huh? I contacted my DNS admin about adding the MX record and already have sendmail installed. Hopefully the MX record will be added tomorrow and I'll update then. – shanet Nov 8 '11 at 4:52

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.