I wrote the code to read mails from the server using IMAP in python. I have to run the program at each time to get the new mails. Hence I went through several tutorials 1, 2, where I found that While loop and idle() method can be used for this process. I know how to use while loop for this purpose.
while True:
mail.select("Inbox")
##some data
time.sleep(120)
Now want to use idle() method for the same purpose. How can do this ?