In the old days when there were no therapists, people used to go to confession, in that sense the church served the purpose of people's mental wellbeing
Religion is a mental disease... also, only catholics did confession.
IN the olden days, people did much more physical work, they were tired when they went to bed, their food wasn't processed. They got plenty of sunlight. I rather think these factors were more likely to contribute to mental wellbeing.