Email_imap_content

Is there a way to only review emails that came in for the last 5 minutes or so ? Or does it only update the state when a new email comes in?

Currently doing something like this:

  - platform: imap_email_content
    name: Gmail read
    server: imap.gmail.com
    search: SUBJECT dominos pizza order confirmation
    port: 993
    username: !secret x_google
    password: !secret x_google_pw
    folder: Inbox
    senders:
      - [email protected]
    value_template: >-

I’ve read through the documentation and there’s no configuration parameter for “last x minutes”.

I would look at doing this with a condition. You’re probably going to have to do something custom with a value template, this thread contains an example which might give you some hints. I’ve never tried this and it would take me quite a while to puzzle it out.

1 Like

Reading through the docs and the code, it’s only going to act on any new emails that come in, initially seeded with “emails that came in today” at HA start. The logic is here.

1 Like

Thanks all. Seems i need to have 2fa enabled for this, or even it might not work currently anymore:

To help keep your account secure, from May 30, 2022, ​​Google no longer supports the use of third-party apps or devices which ask you to sign in to your Google Account using only your username and password.

Important: This deadline does not apply to Google Workspace or Google Cloud Identity customers. The enforcement date for these customers will be announced on the Workspace blog at a later date.

For more information, continue to read.