Forward mail to other adress

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

  1. dtech

    dtech New Member

    Hello,
    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 (user@mydomain.com) 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:
    user@domain.com -> somename@gmail.com
    otheruser@otherdomain.com -> someone@otherwebservice.com

    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
    Code:
    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/main.cf, for example with nano ("nano /etc/postfix/main.cf")
    
    virtual_mailbox_domains = yourdomain.com yourotherdomains.com
    virtual_mailbox_maps = hash:/etc/postfix/virtual
    
    4. change /etc/postfix/virtual to suit your needs, syntax like this:
    user@domain.com other@mail.com
    user@otherdomain.com other@othermail.com
    
    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/main.cf
    To change adresses, edit /etc/postfix/virtual and then repeat step 5
    
     

Share This Page