From 2f29fd458fc1cb3061d3b192726d68495757c1cd Mon Sep 17 00:00:00 2001 From: DavidFW1960 <36390762+DavidFW1960@users.noreply.github.com> Date: Tue, 12 Feb 2019 00:52:57 +1100 Subject: [PATCH] Adding example for doing a search (#8431) * Adding example for doing a search Not intuitive and it took me a while but I worked it out so I'm documenting here. * Minimize the conf sample and move search to full sample --- source/_components/sensor.imap.markdown | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/source/_components/sensor.imap.markdown b/source/_components/sensor.imap.markdown index e993ffbd0fd..57fe0ec41b9 100644 --- a/source/_components/sensor.imap.markdown +++ b/source/_components/sensor.imap.markdown @@ -24,8 +24,7 @@ To enable this sensor, add the following lines to your `configuration.yaml` file # Example configuration.yaml entry sensor: - platform: imap - server: imap.gmail.com - port: 993 + server: YOUR_IMAP_SERVER username: YOUR_USERNAME password: YOUR_PASSWORD ``` @@ -66,9 +65,21 @@ search: ### {% linkable_title Configuring IMAP Searches %} -By default, this component will count unread emails. By configuring the search string, you can count other results, for example: +By default, this component 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](https://tools.ietf.org/html/rfc3501#section-6.4.4)) -* [Gmail's IMAP extensions](https://developers.google.com/gmail/imap/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! +* [Gmail's IMAP extensions](https://developers.google.com/gmail/imap/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! +#### {% linkable_title Full configuration sample with search %} + +```yaml +# Example configuration.yaml entry +sensor: + - platform: imap + server: imap.gmail.com + port: 993 + username: YOUR_USERNAME + password: YOUR_PASSWORD + search: FROM , SUBJECT +```