I have a senario in mind but I'm not sure how it should be implemented:
I have a mail service with an mx record and an IP address. This mail server could be down sometimes. The incoming mails to this server will be lost in the duration of the down time. Now, I want to implement a service where if the primary mail server is down a second MX record exists and those mails are sent to the secondary mail server. So far it's easy to do. But the problem is that I don't want the mail received to the second mail server to stay there. I want the mail server to periodically check the primary mail server and when it's available, send them to the primary mail server. I know websites like dnsmadeeasy.com provide such services.
But I want to know what the best way to implement this method is? Any guidance would be very much appreciated.