People will come around soon and tell you it's unforgivable and you should just leave. Or in general - leave as you are unhappy.
However - I don't think it's that easy or simple in any marriage, and certainly when you have small kids.
Getting through things like this take time and work on both sides. In some ideal world - you two would have benefitted from family counselling back in the day when it happened. To understand what was going on, what led to the rough patch, etc. And after you found messages - counselling would have been helpful too.
But you are where you are. I am guessing you don't have time, energy, money to get therapy, so you'll have to see if you can help yourself.
Personally - I'd say the issue is not how the old flame looked. He did not reach out to her as he was seeking her. It was his reaction to the situation and the state of your marriage then. Granted - not a great reaction, but again, you can't change the past.
Think how you two got into that rough patch. Think about how to avoid those in the future. How are you two now? Are you both making effort? Are you in a better place? Do you get some time for just the two of you as a couple, not just being co-parents?
As to your libido - small kids can take it out of you, it happens very often. We are tired, our bodies have changed, etc. It's easy to fall into that place and not bother. Unfortunately, it does affect the relationship, there is no way around it. Men feel neglected, and it makes them feel unloved. Yes - angry and hurt response is justified, on your side. But you also need to understand his side of the story - how he felt back then, etc. I don't think two people can get through this without being able to talk and understand the whole picture, not just your side.
Good luck!