Brachos 3:4-5
Brachos 3:4
A man who had a seminal emission recites Shema mentally, not verbally. Likewise, he does not recite the brachos before and after Shema. He recites the brachos after food but not the brachos before food; Rabbi Yehuda says he recites brachos both before and after food. (The laws of a baal keri – a man who had a seminal emission – were instituted by Ezra. While practiced in the time of the Mishna, they were not universally accepted and are not observed today.)
Brachos 3:5
If a man was reciting Shemoneh Esrei and he remembered that he was a baal keri, he does not stop abruptly but he does shorten his prayer (by reciting an abbreviated form of the remaining brachos). If he went to immerse in a mikvah and is able to finish, dress and recite Shema before sunrise (which is the optimum time to do so), then he should do so. If he cannot do all that in the time allotted, he should cover himself with the water and recite Shema. One may not do this with foul-smelling water until he dilutes it sufficiently that it is no longer offensive. Otherwise, one must distance himself from it a minimum of four cubits (about six feet). One must distance himself similarly from excrement.