External domain alias (mail)

Discussion in 'General' started by tijn, Jun 17, 2015.

  1. tijn

    tijn New Member

    Hi all,
    I'm trying to accomplish the following:

    Mail send to randomuser@domain1 needs to go to randomuser@domain2 (domain2 is external).
    I created an domain alias but as expected it tries to deliver the mail internal (had to create domain2 as a mail domain),
    My questions are:
    A) Is this the best way to do it?
    B) How can i use an domain alias for an external domain?

    Thanks in advance for the help!
     
    Last edited: Jun 17, 2015
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    The easiest way is to just change the MX record of domain.com to point to the mail server of domain2.com. If you want to route the email trough your own mailserver before they get delivered to domain2.com, then you can remove domain.com as email domain in ispconfig and add a email routing (transport) plus a relay recipient record in ispconfig instead. Email domains in postfx are always local, if you want to forward email by smtp, use a transport.
     
  3. tijn

    tijn New Member

    Thanks for the quick reply!
    But in that case, domain2 must relay for domain1 if i'm correct?
    domain2 is external, so i have no control over it..
     
    Last edited: Jun 17, 2015
  4. tijn

    tijn New Member

    Found it! (woohoo):
    in postfix main.cf:
    virtual_alias_maps = regexp:/etc/postfix/domain_rewriting, etc etc

    root@server:/etc/postfix# cat /etc/postfix/domain_rewriting
    /^(.*)@domain1$/ ${1}@domain2

    Save and restart postfix
     

Share This Page