I have found the issue to the problem and fixed it. Somewhere on the gmail settings or search on google for "gmail access less secure apps". When you find that, enable it and it works for the htc mail app.
Second is make sure imap and pop servers is enabled on gmail through the browser
Took me time going through the gmail settings and found it. I have no problems using htc mail app now. It is simple for logging in the htc mail app with the gmail login without manual settings on it.