Results 1 to 7 of 7

Thread: postfix root email forward

  1. #1
    Join Date
    Oct 2008
    Beans
    122

    Smile postfix root email forward

    Hi, I would like to forward all mail that goes to postfix's root email account to a different account on the same server.

    Any ideas?

    I am a little new to postfix.

    Thanks Dan

  2. #2
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: postfix root email forward

    Postfix uses the same /etc/aliases file as sendmail does. Edit, as root with sudo, the file /etc/aliases and add this line to the top:

    Code:
    root:     yourusername
    replacing "yourusername" with the name of the account to which you'd like root's mail delivered. Then run the command "sudo newaliases" to update the alias database. That's it!

  3. #3
    Join Date
    Oct 2008
    Beans
    122

    Re: postfix root email forward

    Hi thanks for the reply, I am not working now so I will try this tomorrow.

    Would it make any difference that the email account I want to forward all emails to is in courier and not postfix?

  4. #4
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: postfix root email forward

    Quote Originally Posted by DanHorniblow View Post
    Hi thanks for the reply, I am not working now so I will try this tomorrow.

    Would it make any difference that the email account I want to forward all emails to is in courier and not postfix?
    ???

    You said the account is on the same server as Postfix. Are you running two MTAs on the same server listening on different ports? Or by "in courier" do you mean the mailboxes are in the Maildir format (one message per file) rather than mbox (one file per folder)?

    I suspect the answer is it doesn't make any difference since Postfix uses the aliases file simply to rewrite the destination address. If mail to user "joey" gets delivered correctly now, then having an alias that points "root" to "joey" should work fine.

  5. #5
    Join Date
    Oct 2008
    Beans
    122

    Re: postfix root email forward

    I did not create the server myself, so I don't know a massive amount about it.

    I think that postfix handles all of the SMTP traffic and Courier is used for all of the IMAP. We don't use POP3.

    However for example I know that all the emails for the email account "name@domain.com" would be stored as seperate files in "/var/vmail/domain.com/name/" and all of the users mail folders would be in their aswell.

  6. #6
    Join Date
    Oct 2008
    Beans
    122

    Re: postfix root email forward

    In the end I just created a file in "/root/" called ".forward" and on the first line of that file I just wrote my email address.

    I didn't expect it to work but it did! Now any mail that goes to the root account is forwarded to my email address.

  7. #7
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: postfix root email forward

    Yep, the old tried-and-true Unix method. Since only root can edit /etc/aliases there needed to be a way for unprivileged users to forward mail. The .forward file is that method.

    You can add additional addresses separated by commas, and you can even have the mail delivered to both root and yourself like this:

    Code:
    \root,dan,fred@example.com
    That puts a copy of each message in /var/spool/mail/root and sends another copy to the local account dan and a third to fred@example.com. See "man aliases" for details on other options like piping messages to a program. (The hoary Unix vacation program uses this method.)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •