IMAP
The IMAP integration is observing your IMAP server and reporting the number of unread emails. Other search criteria can be used, as shown in the example below.
Configuration
Adding IMAP to your Home Assistant instance can be done via the user interface, by using this My button:
If the above My button doesn’t work, you can also perform the following steps manually:
-
Browse to your Home Assistant instance.
-
In the sidebar click on Settings.
-
From the configuration menu select: Devices & Services.
-
In the bottom right, click on the Add Integration button.
-
From the list, search and select “IMAP”.
-
Follow the instruction on screen to complete the set up.
Gmail with App Password
If you’re going to use Gmail, you need to create an App Password.
- Go to your Google Account
- Select Security
- Under “Signing in to Google” select App Passwords
- Sign in to your Account, and create a new App Password for Gmail.
- Then you can setup the intergation as below:
- Server:
imap.gmail.com
- Port:
993
- Username: Your full email address
- Password: The new app password
- Server:
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!
Selecting a charset supported by the imap server
Below is an example for setting up the integration to connect to your Microsoft 365 account that requires US_ASCII
as charset:
- Server:
outlook.office365.com
- Port:
993
- Username: Your full email address
- Password: Your password
- Charset:
US-ASCII