VOOZH about

URL: https://www.home-assistant.io/integrations/google_mail

⇱ Google Mail - Home Assistant


The Google Mail integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] allows you to connect your Google Mail to Home Assistant. The integration adds an action to allow you to set an email auto-response for when you go on vacation. A notify action 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 service to your Home Assistant instance, use this My button:

👁 Image

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.

Action: Set vacation

The google_mail.set_vacation action allows you 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 action data

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

Attribute Optional Description
cc yes List of recipients to be carbon-copied.
bcc yes List of recipients to be blind-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.
alias_from yes Name that will be showed to the receivers instead of the user email. You have to set from if you want to use this option.

Examples

This is the full action to send an email:

action: notify.example_gmail_com
data:
 message: "test"
 title: "testemail"
 target:
 - "[email protected]"
 data:
 cc:
 - "[email protected]"
 bcc:
 - "[email protected]"
 from: "[email protected]"
 alias_from: "Examplealias"

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.

Help us improve our documentation

Suggest an edit to this page, or provide/view feedback for this page.