You should write a letter letting the mortgage company know that you are the tenant in residence. Take a copy and file it with the Clerk of the Courts for the foreclosure action.
Do you have a written Lease agreement?
The federal act passed in 2009 may give you some protection. the new owner will have to give you 30 days notice before filing an eviction action if they plan to live in the premises. the new owner will have to give you 90 days notice if they don't plan to live there.