You can use this python script to read email directly from your gmail inbox to your program.
This will help you to read mail from your inbox in realtime.
It is easy to configure. Just enter your email address and password.
If you want to extract particular text from email for instance OTP from mail then you can use regex.