Check Email on Time / Turn on Wi-Fi on time I really need this piece of advice, I've been tortured for months now and don't really know how to solve this. 

The problem is I can receive working emails at night. But I don't want to be waked up at 5am. Still, I don't want to wake up at 7am if there were no emails at night. I had a temporal solution which was to use apps for automatic turn on of wi-fi. It would sometimes turn on wifi on 7 am, so my Gmail app would check emails. But these apps fail once in a while so you are never quite sure if it's working or not. 

Some people suggest using different audio profiles, but it won't help since, for example, if there was a letter at 5 am and audio profile starts working at 7 am it won't ring again, because it was already in my inbox. 

Please, your suggestions are very appreciated. I'm tired of sleep deprivation. If you know any mail apps that can check email in specific periods of time this would be perfect.
Some smartphones come with "Do not disturb" functionality. You can use this function to mute all calls and alerts, apart from your selected exceptions on the time range that you set.