Forward mail to other adress

Discussion in 'Server Operation' started by dtech, Jul 15, 2008.

  1. dtech

    dtech New Member

    I have an debian 4.0 VPS with apache (with some virtual hosts), php, mysql. You know the drill.
    I mainly use my gmail adress for mailing, but used a custom ([email protected]) e-mail adress before, and want to forward mail to my main account.
    The same applies to some people I host websites for.
    So I want something like this:
    [email protected] -> [email protected]
    [email protected] -> [email protected]

    Does anyone know how to do this?
  2. dtech

    dtech New Member

    I already found the answer.
    I tried postfix before, but it didn't work. Turns out I did not know about the (here) final step.

    I use postfix, here are instructions to set it up yourself
    1. If you have any MTA's, remove them, you'll delete most common with:
        apt-get remove exim exim4 sendmail qmail
    2. If you didn't already, install postfix
        apt-get install postfix
    3. add these lines to /etc/postfix/, for example with nano ("nano /etc/postfix/")
    virtual_mailbox_domains =
    virtual_mailbox_maps = hash:/etc/postfix/virtual
    4. change /etc/postfix/virtual to suit your needs, syntax like this:
    [email protected] [email protected]
    [email protected] [email protected]
    5. Generate virtual.db by executing the following commands as root:
    cd /etc/postfix/
    postmap /etc/postfix/virtual
    If you want to add a domain, edit the virtual_mailbox_domains line in /etc/postfix/
    To change adresses, edit /etc/postfix/virtual and then repeat step 5

Share This Page