> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jinba.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Gmail

> Email operations using Gmail API

## Overview

These tools provide functionality for email management using the Gmail API.

## Key Features

* `GMAIL_LIST_MESSAGES`
  * List messages in the user's mailbox
* `GMAIL_GET_MESSAGE`
  * Retrieve a specific message by ID
* `GMAIL_SEND_MESSAGE`
  * Send an email message
  * Supports sending as a draft or directly to the recipient
  * Optional CC recipients for sharing copies

## Authentication

For further details, [click here](/en/pages/credentials/google-oauth).

To use the Gmail API, you need navigate to the [Jinba secrets dashboard](https://flow.jinba.io/workspace/secrets) and authenticate with your Google account. This will create a new OAuth token for you.

**Note**: Treat API keys as sensitive information and never commit them to public repositories.

### Example: List, Get, and Send Messages

```yaml theme={null}
- id: list_messages
  tool: GMAIL_LIST_MESSAGES
  config:
    - name: token
      value: "{{secrets.GMAIL_OAUTH_TOKEN}}"
  input:
    - name: user_id
      value: me
- id: get_message
  tool: GMAIL_GET_MESSAGE
  needs:
    - list_messages
  config:
    - name: token
      value: "{{secrets.GMAIL_OAUTH_TOKEN}}"
  input:
    - name: id
      value: "{{steps.list_messages.result.messages[0].id}}"
    - name: user_id
      value: me
- id: send_message
  tool: GMAIL_SEND_MESSAGE
  needs:
    - get_message
  config:
    - name: token
      value: "{{secrets.GMAIL_OAUTH_TOKEN}}"
  input:
    - name: as_draft
      value: true
    - name: user_id
      value: me
    - name: to_email
      value: test@example.com
    - name: cc_emails
      value: cc@example.com, manager@example.com
    - name: subject
      value: test draft
    - name: body
      value: draft
```
