Here is a recent article.
When I was 10, my dad told me that I could continue to go to church and he would drive me and go with me, or, alternatively, I didn't need to go anymore. I asked him why he would allow me not to go (we went to Methodist church).
He basically told me that church does a lot of things for a lot of people and gives them structure and community. But going to church does not make you a good person, and not going to church does not make you a bad person. My mother, who is a far more blunt person, told me that some of the worst people in the community were huge bible thumpers and enormous hypocrites.
I stopped going to church when I was 10. I never enjoyed it, and I really never got much out of it. I remember one time when I was like 7, I went to Sunday school for a week. The lady read us a story and then asked questions about the story. I answered them all, every single one. Then she gave us a coloring book and I colored, which I hated (coloring). I wanted more questions, even at age 7.
Anyway, what am I getting at? Well, the church is full of three types of people, each of whom make up about 1/3 of the total church-going population: 1) good people who actually believe that people should lead good lives and lead their lives that way (my friend Curt - I tell people that I am happy to know that Curt is my friend because him being associated with me gives people the impression that I am a much better person than I actually am); 2) people who believe that they should make a moderate effort to be a good person, but God will forgive them in the end even if they are not (Bill Clinton); and 3) those who, as Donald Trump says about Ted Cruz, "Hold the Bible up with one hand and then put it down and lie about everything." These people use religion as a sort of disguise so that they can do all sorts of awful things and then say "but I am better than you because I am religious and go to church." They are the worst kind of people. (Most televangelists)
Trump appeals to groups 2 and 3. He certainly does NOT appeal to Group 1. The issue of whether he can beat Ted Cruz with these 3 groups comes down to how hard the person in Group 2 tries. If the person makes a shitty effort and cheats on their wife with their wife's sister, they are a possible Trump voter. If the person stayed with their wife for 15-20 years and then got divorced, despite the fact that they knew they should not (per church teachings) and maybe they drink a little too much and swear a little too much, they probably still are not a Trump voter.
How can religious people vote for Trump? Most religious people are either pretty flawed (Group 2) or completely full of shit (Group 3). Since they constitute 67% of the church goers, Trump has fertile ground to plow there. PLUS churchgoers pretty aggressively seek out structure and following of powerful men, and will do basically anything they are told whether it makes sense or not (that is the whole basis of "faith"). That usually makes them good Republicans, and good candidates to vote Trump.