Email domain forwarding

Discussion in 'Installation/Configuration' started by stevieb, Jan 29, 2009.

  1. stevieb

    stevieb New Member

    Hi guys,

    Using ISPConfig 2, is there any way to automatically forward email from one domain to another domain. In cPanel, this is known as Email Domain Forwarding, and it means you don't have to define each address separately and have to create a forwarder for it.

    So what I want is:

    [email protected] => [email protected]

    This is very useful for companies who have two similar domains like the .com and the .co.uk and want email handled for both (in case someone actually types their email address with the wrong tld extension) but still receive the emails.

    The one complication is that domain2.tld could be an external mail server so the email would only pass through the ISPConfig server for it to be re-addressed from domain1.tld to domain2.tld.

    Any ideas how I can achieve this?

    Is it possible by setting up a catch all mailbox? I would imagine that a catch-all would have to forward to a specific address which isn't what I want as this means one user would receive all mail for all users.

    Thanks in advance.

    Steve.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Add domain2.tld as co-domain to the website domain1.tld.
     
  3. stevieb

    stevieb New Member

    Thanks for the suggestion but that doesn't work....I did try it as follows:

    Domain1.tld created on ISP config as a site, set to external mailserver
    Domain2.tld added as a co-domain, set to local mailserver.

    When emailing [email protected], I receive a bounce message saying user does not exist in local user table.

    So then I create a catchall on User/Email tab on Domain1.tld

    When emailing [email protected], the email is accepted and delivered into the catchall POP mailbox, but the email is not automatically forwarded to [email protected] (external mailserver) which is what I want to happen.

    Any further advice or suggestions?

    Steve.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    make sure that co-domain domain2.com has a empty hostname field and that you have a user with email [email protected]. You must create this user account even if you set domain1.tld to external mailserver!
     
  5. stevieb

    stevieb New Member

    As my last post states, I did try creating a catchall mail user for domain1.tld but it did not achieve the forwarding... it just ensured the email was delivered to this POP box which is not what I want.

    I need *@domain2.tld to auto-forward to *@domain1.tld

    I'm starting to think this isn't possible in ISPConfig. If not, is there a way using postfix without interferring with ISPConfig?
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    The email has to be delivered to the pop box as the forwarding is done by a procmail recipe.

    Either you have to put both domains on this server or you set both domains to external server and point the mx record for domain2.tld to the msila server of domain1.tld
     
  7. stevieb

    stevieb New Member

    Hi Til,

    Thanks for your quick responses

    Unfortunately the MX record solution isn't an option for us because we use a 3rd party antispam solution which only accepts email for on domain1.tld and will reject anything for domain2.tld....hence why we need the email re-addressed to [email protected]

    I think I'll look at doing this outside of ISPConfig. Once I find the solution, I will post here so this thread helps other users who might be in the same position as me.
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    You can add a transports directive in postfix main.cf and define the mail routing in the transports file then.
     
  9. stevieb

    stevieb New Member

    Thanks,

    I found what I wanted by editing the virtusertable in /etc/postfix and adding the following below the MAKE MANUAL CHANGES BELOW THIS LINE which ISPConfig puts in:

    Code:
    @domain1.tld    @domain2.tld
    Tested this and it works great...all email regardless of alias is sent out onto the 2nd domain....and ISPConfig already handles whether the domain is local or external, so didn't have to change anything else except this one change to virtusertable.

    Remember to rebuild the virtusertable using
    Code:
    makemap hash virtusertable < virtusertable
    Thanks for your help Til.
     

Share This Page