How to use an incoming email as a trigger for an alert

Hi.

I am trying to set up an alert/notification that is triggered by an incoming email. This could be from a specific email address or simply whenever any email is received. I have successfully installed the IMAP integration but I can not figure out how to get it to fire a trigger using it. Does anyone have any suggestion on how to achieve this?

Thank you!

There are examples at the bottom of the documentation page (scroll down): IMAP - Home Assistant

Screenshot 2023-12-24 at 12-47-54 IMAP

1 Like

Hi @tom_l ! Thank you for this. I did try it and so far can not get it to work.

Here is what I have done so far. Note that the only thing I changed in the below example is the email address. Should something else be edited for my case? I am not very fluent with HA so I am sure I am missing something obvious.

description: TEST
trigger:
  - platform: event
    event_type: imap_content
    id: custom_event
    event_data:
      sender: [email protected]
condition: []
action:
  - service: notify.notify
    data:
      message: TEST
      title: TEST
mode: single

Thank you!

Check the automation trace:

1 Like

I did not make any other changes except rebooting HA but it suddenly started working! Thanks so much!

Hi @tom_l . Sorry but one last question. How can I make it alert if I receive ANY email, not from a specific one but literally any? I tried * and that did not seem to work. Any suggestion? Thank you!

Leave out the event_data

1 Like