HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Installation/Configuration (http://www.howtoforge.com/forums/forumdisplay.php?f=16)
-   -   Email domain forwarding (http://www.howtoforge.com/forums/showthread.php?t=30741)

stevieb 29th January 2009 17:12

Email domain forwarding
 
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:

user-alias-here@domain1.tld => user-alias-here@domain2.tld

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.

till 29th January 2009 19:49

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

stevieb 30th January 2009 11:41

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 anything@Domain2.tld, 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 anything@Domain2.tld, the email is accepted and delivered into the catchall POP mailbox, but the email is not automatically forwarded to anything@Domain1.tld (external mailserver) which is what I want to happen.

Any further advice or suggestions?

Steve.

till 30th January 2009 12:54

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

stevieb 30th January 2009 13:03

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?

till 30th January 2009 13:14

Quote:

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.
The email has to be delivered to the pop box as the forwarding is done by a procmail recipe.

Quote:

I need *@domain2.tld to auto-forward to *@domain1.tld
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

stevieb 30th January 2009 13:32

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 user@domain1.tld

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.

till 30th January 2009 16:18

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

stevieb 30th January 2009 18:51

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.


All times are GMT +2. The time now is 03:41.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.