This is my code for the mail-listener file.
I call the startListening function in my main file, and I can read \"Imap connected\" in the console , but then, even if
For the snippet of code to work, remove the:
searchFilter: "FLAGGED"
Currently, you are just searching for unseen, flagged emails, and likely the incoming email is not flagged as important. I had the exact implementation above, without the FLAGGED search filter, and this works perfectly.