I have a Linux VPS and a hosted exchange server from somewhere else. I can receive emails from my exchange server if I point mx entry on my VPS to exchange server. But if I point mx entry, same account on my VPS does not get emails. Yes this is how it works, I know. Is there a way to get emails on both remote exchange mail server and my local VPS? Is there any DNS settings for this? Basically I want to do something like mirroring.
Unfortunately MX records do not work like that. You can specify multiple MX records for redundancy, should one server fail, but you will only get mail delivered to one server.
MX records work on a system of priority, so smtp servers will attempt to send mail to the MX record with the lowest priority first, then if they cannot, the next and so on. If you have multiple MX records with the same priority then it will pick a record at random manor, in a similar way to round robin DNS. Once it has delivered mail, it will not try any more.
If you want to get mail delivered to both servers, I would suggest using one as primary and receiving all mail, and then forwarding on to the other. You can set the secondary mail server with an MX record priority higher than the primary so that should the primary fail all mail will go to the secondary.
well, there is an easy option if you front end with postfix by using the always_bcc option...
always_bcc (default: empty)
Optional address that receives a "blind carbon copy" of each message that is received by the Postfix mail system.
Note: if mail to the BCC address bounces it will be returned to the sender.
Note: automatic BCC recipients are produced only for new mail. To avoid mailer loops, automatic BCC recipients are not generated for mail that Postfix forwards internally, nor for mail that Postfix generates itself.
Additionally, you could setup canonical and transport mappings for forwarding in a similar manner.
"Does not get emails" is a very useless report. What did you do and what was the result? The error messages? Did you get a bounce? If so, post it. Etc...
As EasyEcho said, the second step is to have a mail server on the Linux VPS. (The first step being to decide on your addressing plan: choose the domain names for the addresses that will go to Exchange and those for the addresses that will go to the Linux VPS.) When it is done, tell us the make.