# GMailLoader

> **Class** in `langchain_google_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-google-community/gmail/loader/GMailLoader)

Load chat sessions from Gmail.

Inherits from
[`BaseChatLoader`][langchain_community.chat_loaders.base.BaseChatLoader].

Loads sent messages and their preceding emails to create chat training examples.

This loader finds messages you've sent in reply to previous emails and creates
chat sessions from the original email and your response. Each session contains
only the immediate previous email for context.

!!! note "Setup Required"

    Requires Google Developer Account with Gmail API enabled. See
    [Gmail API documentation](https://developers.google.com/gmail/api/guides)
    for setup instructions.

## Signature

```python
GMailLoader(
    self,
    creds: Any,
    n: int = 100,
    raise_error: bool = False,
)
```

## Extends

- `BaseChatLoader`

## Constructors

```python
__init__(
    self,
    creds: Any,
    n: int = 100,
    raise_error: bool = False,
) -> None
```

| Name | Type |
|------|------|
| `creds` | `Any` |
| `n` | `int` |
| `raise_error` | `bool` |


## Properties

- `creds`
- `n`
- `raise_error`

## Methods

- [`lazy_load()`](https://reference.langchain.com/python/langchain-google-community/gmail/loader/GMailLoader/lazy_load)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-google/blob/982e4015b249de8b9ba1e787746d8cc1f6d6b790/libs/community/langchain_google_community/gmail/loader.py#L66)