Google Mail


The Google Mail integration allows you to connect your Google Mail to Home Assistant. The integration adds a service to allow you to set an email auto-response for when you go on vacation. A notify service is also added, allowing you to draft or send emails in plain text.

Prerequisites

You need to configure developer credentials to allow Home Assistant to access your Google Account. These credentials are the same as the ones for Nest and Google Sheets and YouTube. These are not the same as Device Auth credentials previously recommended for Google Calendar.

Scenario 1: You already have credentials

In this case, all you need to do is enable the API:

  1. Go the Google Developers Console Gmail API .
  2. Confirm the project and Enable the API.
  3. Continue with the steps described in the Configuration section.

Scenario 2: You do not have credentials set up yet

In this case, you need to generate a client secret first:

Configuration

To add the Google Mail integration to your Home Assistant instance, use this My button:

The integration setup will next give you instructions to enter the Application Credentials (OAuth Client ID and Client Secret) and authorize Home Assistant to connect to Google Mail.

Troubleshooting

If you have an error with your credentials you can delete them in the Application Credentials user interface.

Service google_mail.set_vacation

You can use the service google_mail.set_vacation to set vacation options.

The added notify service will be named after the email address you chose on the consent screen. For example, an email address named “[email protected]” wil display as notify.example_gmail_com.

Google Mail notify service data

The following attributes can be placed inside the data key of the service call for extended functionality:

Attribute Optional Description
cc yes List of recipients to be carbon copied.
bcc yes List of recipients to be back carbon copied.
from yes Default is current authenticated user. Typically only applies to GSuite accounts where the user has delegate access to a shared mailbox.
send yes Default is true. Set this to false to create a draft instead. Recipients are not required in this instance.

Examples

This is the full service call to send an email:

service: notify.example_gmail_com
data:
  message: "test"
  title: "test email"
  target:
    - "[email protected]"
  data:
    cc:
      - "[email protected]"
    bcc:
      - "[email protected]"
    from: "[email protected]"

Video tutorial

This video tutorial explains how to set up Gmail in Home Assistant and how you can create a dashboard and automations to send email and toggle your out-of-office notice.