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. These are not the same as the one for Google Calendar. If you have already set up the correct credentials, you can do step 1 and then skip to step 13 on the below instructions.

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 access your 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 e-mail and toggle your out-of-office notice.