title: How can I run an email listener with exchangelib that triggers when a new mail is received?
body: <p>I want to write a service that takes a message from my outlook account. For connection to outlook, I used <code>exchangelib</code> but I didn't find how to run listener for incoming emails. Here is my code.</p>
  
  <pre><code>from exchangelib import DELEGATE, Account, Credentials
  from creds import PASSWORD, USERNAME, EMAIL
  
  creds = Credentials(
      username=USERNAME,
      password=PASSWORD)
  account = Account(
      primary_smtp_address=EMAIL,
      credentials=creds,
      autodiscover=True,
      access_type=DELEGATE)
  
  # Print first 100 inbox messages in reverse order
  for item in account.inbox.all().order_by('-datetime_received')[:1]:
      print(item.subject, item.body, item.attachments)
  </code></pre>
  
  <p>It's a simple example that I found and it return to me last message from my incoming mailbox.</p>
  
  <p>Please, can you give me some link where I can find a solution or help me to write listener service?</p>