More detail is needed. did you change service providers? did you try deleting the accounts and re-adding them on the phone. Generally this error can be the result of converting to a different provider but if you did not then it may be necessary to delete them.
This link may offer some info. KB32866-Error "Your device had a problem connecting to the server" is displayed when attempting to integrate an email account in the Email Setup application