IMAP Unread E-mail


The imap integration is observing your IMAP server and reporting the amount of unread emails.

Configuration

To enable this sensor, add the following lines to your configuration.yaml file:

# Example configuration.yaml entry
sensor:
  - platform: imap
    server: YOUR_IMAP_SERVER
    username: YOUR_USERNAME
    password: YOUR_PASSWORD

Configuration Variables

server

(string)(Required)

The IP address or hostname of the IMAP server.

port

(integer)(Optional)

The port where the server is accessible.

Default value:

993

name

(string)(Optional)

Name of the IMAP sensor.

username

(string)(Required)

Username for the IMAP server.

password

(string)(Required)

Password for the IMAP server.

folder

(string)(Optional)

The IMAP folder to watch.

Default value:

inbox

search

(string)(Optional)

The IMAP search to perform on the watched folder.

Default value:

UnSeen UnDeleted

charset

(string)(Optional)

The character set used for this connection.

Default value:

utf-8

Configuring IMAP Searches

By default, this integration will count unread emails. By configuring the search string, you can count other results, for example:

  • ALL to count all emails in a folder
  • FROM, TO, SUBJECT to find emails in a folder (see IMAP RFC for all standard options)
  • Gmail’s IMAP extensions allow raw Gmail searches, like X-GM-RAW "in: inbox older_than:7d" to show emails older than one week in your inbox. Note that raw Gmail searches will ignore your folder configuration and search all emails in your account!

Full configuration sample with search

# Example configuration.yaml entry for gmail
sensor:
  - platform: imap
    server: imap.gmail.com
    port: 993
    username: YOUR_USERNAME
    password: YOUR_PASSWORD
    search: FROM <[email protected]>, SUBJECT <subject here>

# Example configuration.yaml entry for Office 365
sensor:
  - platform: imap
    server: outlook.office365.com
    port: 993
    username: [email protected]
    password: password
    search: FROM <[email protected]>, SUBJECT <subject here>
    charset: US-ASCII