Imap_email_content always returning unknown

Can anyone give me any hints on how to get this component working? I’m trying to use the exact example given in the documentation but it always returns ‘unknown’.

It seems there are various posts about different problems with this component and I’ve tried different workarounds but none work. Does this component even work properly?

My configuration:

- platform: imap_email_content
  server: outlook.office365.com
  name: courier_delivered
  port: 993
  username: !secret o365_email
  password: !secret o365_password
  folder: Inbox
  senders:
    - [email protected]
  value_template: >-
    {% if "has been delivered" in subject %}
      Yes
    {% else %}
      No
    {% endif %}

- platform: imap_email_content
  server: outlook.office365.com
  name: courier_delivering
  port: 993
  username: !secret o365_email
  password: !secret o365_password
  folder: Inbox
  senders:
    - [email protected]
  value_template: >-
    {% if "is on the way!" in subject %}
      Yes
    {% else %}
      No
    {% endif %}

Have you got solution?