Search code examples
http-redirectpostfix-mta

Postfix - adding domain + forwarding setting


I have a question as to postfix add a new domain to be able to it to send and receive e-mails? How to redirect all emails sent to this domain went to an external email address?

Regards, Darek


Solution

  • Adding a domain will be adding it to mydestination= example.com in main.cf

    the second question is called a "catch all"

    Mapping is done using /etc/postfix/virtual file.

    vim /etc/postfix/virtual
    

    Append code as follows, replacing domain and emailusername with actual values:

    @yourdomain.com emailusername
    

    Save and close the file. Run following command:

    postmap /etc/postfix/virtual
    

    Also make sure you have following line in /etc/postfix/main.cf file:

    virtual_alias_maps = hash:/etc/postfix/virtual
    

    If you just added above, line reload postfix:

    service postfix reload