Forward e-mail to another server

Use this forum if you have installed hMailServer and want to ask a question related to a production release of hMailServer. Before posting, please read the troubleshooting guide. A large part of all reported issues are already described in detail here.
Post Reply
chanas
Normal user
Normal user
Posts: 57
Joined: 2006-04-08 00:27
Location: Athens/Greece
Contact:

Forward e-mail to another server

Post by chanas » 2007-07-30 00:41

Well my scenario is this. I have 2 hmailServers with exactly the same domains and users. Server1 is the frontend, receiving the e-mails. I want each mail received by Server1 to be delivered locally to Server1 but also forwarded (same as Routes does) to Server2. So in the end both mailservers
have the same e-mails.

Is this possible (setting, script,anything)?
Win2K3 SP2 | IIS6 | hMail 4.3 B248 | MSSQL 2K | Debian SpamAssasin on VMWare | SquirrelMail

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Post by ^DooM^ » 2007-07-30 01:01

Are these servers on the same network and do you run your own DNS?

Depending on the above answers this can theoretically be achieved although I have no way to test this.

Setup a domain alias on server 2 that is an alias of the domain name you are trying to send to (Depending on the answer to the above question this will either have to be a FQDN (Subdomain for instance with a proper IP) or if its on your network can be a dummy local domain.

In either case you should be able to forward email to the new sub / dummy domain from server 1 to server 2. Emails should end up in the correct mail boxes.

This may or may not work I am not 100% sure. In my head it should work, In practice... you will just have to test it :)

Let me know how you get on.

If anyone knows a better way to achieve this please pipe up ;)

chanas
Normal user
Normal user
Posts: 57
Joined: 2006-04-08 00:27
Location: Athens/Greece
Contact:

Post by chanas » 2007-07-30 01:09

Servers are on different networks and I have my own DNS
What I am trying to achieve is a kind of full mirror with server1 as primary and server2 as backup. If server1 goes down i switch the MX record so that it points to server2 and users are happy.

I didnt really understand the alias scenario, maybe its because I'm working 12 hours straight since we had some serious issues with our dedicated server host (Valuweb) and I 'm trying to save the day.
Win2K3 SP2 | IIS6 | hMail 4.3 B248 | MSSQL 2K | Debian SpamAssasin on VMWare | SquirrelMail

chanas
Normal user
Normal user
Posts: 57
Joined: 2006-04-08 00:27
Location: Athens/Greece
Contact:

Post by chanas » 2007-07-30 01:16

I think i understand the idea now....
eg I have
realdomain.com on server1
realdomain.com on server2 with alias dummydomain1.com
I forward each mail to user@dummydomain1.com

Wont that change e-mail headers? If it wont then all is well

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Post by ^DooM^ » 2007-07-30 01:20

Ok i have been having a think about this and there is a fatal flaw in my idea. You cannot forward to just a domain, you have to specify an actual email address in the forward rule. which means you would have to setup a rule for every account on the server.

Maybe Martin can suggest a way to do this.

I guess my head doesn't work either :/

chanas
Normal user
Normal user
Posts: 57
Joined: 2006-04-08 00:27
Location: Athens/Greece
Contact:

Post by chanas » 2007-07-30 01:23

I dont mind if i have to forward to each user, maybe this could be scripted to check for the after the @part.
What i dont know and cant check now (server1 down server2 not existant) is if it will affect the mail headers.

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Post by ^DooM^ » 2007-07-30 01:24

chanas wrote:I think i understand the idea now....
eg I have
realdomain.com on server1
realdomain.com on server2 with alias dummydomain1.com
I forward each mail to user@dummydomain1.com

Wont that change e-mail headers? If it wont then all is well
Depends what you mean by change the headers. If you use the forwarding tab in the users account it should forward the email on but still keep the from header.

Edit (I am just testing this now).. Will reply when i know for sure
Last edited by ^DooM^ on 2007-07-30 01:27, edited 1 time in total.
If at first you don't succeed, bomb disposal probably isn't for you! ヅ

chanas
Normal user
Normal user
Posts: 57
Joined: 2006-04-08 00:27
Location: Athens/Greece
Contact:

Post by chanas » 2007-07-30 01:26

The To: header. I want it to be transparent to the end user.
If the user sees a To: user@mydymmydomain perhaps he wont like it :)

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Post by ^DooM^ » 2007-07-30 01:33

Ok I just tested to forward to my gmail account and checked the header.

from Jon <jon@mydomain.com>
to Jon <jon@mydomain.com>
date Jul 30, 2007 12:28 AM
subject testing forward
mailed-by mydomain.com

So looks like this will work using the account forward functionality in the users account, tick keep original and forward to the dummydomain which is setup as an alias on your server 2

wow talk about screwing with the mind.. :)

chanas
Normal user
Normal user
Posts: 57
Joined: 2006-04-08 00:27
Location: Athens/Greece
Contact:

Post by chanas » 2007-07-30 01:38

Great!
This could be a nice scenario for keeping 2 mirrored hMailservers.
Although scripting it so that you dont have to setup forwarders for each account would be nice.

Thanks a lot Doom! Always helpful as usual :)

^DooM^
Site Admin
Posts: 13861
Joined: 2005-07-29 16:18
Location: UK

Post by ^DooM^ » 2007-07-30 01:39

No Problem, Let us know if that actually works once you get setup :)

DjGL
New user
New user
Posts: 26
Joined: 2006-12-15 14:55

Post by DjGL » 2007-08-07 14:30

What happens if the user deletes a mail on server1?
How does server2 know that?

chanas
Normal user
Normal user
Posts: 57
Joined: 2006-04-08 00:27
Location: Athens/Greece
Contact:

Post by chanas » 2007-08-07 23:37

Thought of that later....it seems IMAPCopy or something like that would be the 'working' solution. But you must know the users passwords...
Win2K3 SP2 | IIS6 | hMail 4.3 B248 | MSSQL 2K | Debian SpamAssasin on VMWare | SquirrelMail

Post Reply