Is it allowed to hack a person’s email in order to bring out the truth if the person is being suspected of cheating on his/her spouse?
No, absolutely not.
Hacking someone’s email is an offense against privacy and it is forbidden. Besides, this kind of actions only cause things to get worse. The Messenger of Allah said:
“Whoever testifies that I am the Messenger of Allah shall not enter a house without getting permission and saluting the household. Whoever looks into a house (from outside) is like as if he is in it.” (Haythami, Majma al-Zawa’id, 8/43)
The Prophet’s words are in accordance with the verses below:
“Believers! Do not enter other houses than your own until you have the approval of the household and have saluted them. This is the best way for you if you use your knowledge. If you do not find anyone therein, do not enter until you have been given permission. If you are told to go back, then go back. This is the mannerly way for you. Allah knows all that you do.” (24:27-28)
Reading someone’s mails secretly is no different than entering a house without permission or looking to the things in there. Both of the acts are an invasion of privacy.