I have a domain and I want that if one mx record fails then 2nd mx should takeover for sending and receiving mails.


Yes, fallback MX is pretty standard. Run dig mx gmail.com and you'll see an example.

However, there is often no real need for it, because mail servers queue mail for a few days anyway, and there are extra problems you'll introduce having a fallback, one being that it's always hit harder by spammers, because its security it often less stringent.

Not the answer you're looking for? Browse other questions tagged or ask your own question.