# Mail (/en/docs/memo/mail)

This page helps you bring your email into Memo, so mail sits beside your notes and messages in
search, in a person's context and in the sources your agent reads. Memo reads mail through
[Himalaya](https://github.com/pimalaya/himalaya), a mail program you set up first. Your mailbox is
opened read-only: Memo never sends, moves or deletes mail, and does not mark it as read.

## Before you start [#before-you-start]

Set up your mail account in Himalaya. For Gmail, use an IMAP account with a Gmail
[app password](https://myaccount.google.com/apppasswords) (a separate password for one program,
which you can revoke at any time). Check that Himalaya lists your mail before you continue.

> ```text prompt
> Help me set up Himalaya for my Gmail account with an app password, and check that it lists my inbox.
> Then add the account to Memo's config and import the last 30 days of mail.
> ```

## Add the account to Memo [#add-the-account-to-memo]

Name the account in Memo's [config file](/llms.mdx/docs/memo/configuration/content.md#mail), `~/.config/cli-memo/config.json`.
`name` is the account's name in Himalaya; `address` is your email address:

```json
{ "mail": { "accounts": [{ "name": "work", "address": "you@example.com" }] } }
```

Gmail is the default. For another provider, add `"mode": "imap"` and the folders to read:

```json
{ "mail": { "accounts": [{ "name": "home", "address": "me@example.org", "mode": "imap", "folders": ["INBOX", "Archive"] }] } }
```

## Import mail [#import-mail]

```sh
memo mail work import --since 2026-09-01
```

`work` is the account's `name` from the config. Name it every time, even with one account: Memo
never picks an account for you, and lists the accounts it knows when the name is missing or wrong.

* Without `--since`, Memo reads the last 30 days.
* Each run reads up to 200 new emails (`--max` changes this). Run it again and it continues where it
  stopped; emails already stored are skipped.
* `memo import` and the timer import every account in the config.

## Find your mail [#find-your-mail]

```sh
memo search mail 'invoice'
memo search mail 'from:kai subject:budget'
memo search mail 'mailbox:starred' --account you@example.com
memo search all 'budget'
```

Gmail labels such as Inbox, Important, Starred and your own labels become mail folders, so
`mailbox:important` finds them. See [Search](/llms.mdx/docs/memo/search/content.md#search-mail).

## What is kept [#what-is-kept]

* The sender, the recipients (To, CC and BCC), the subject, the date and the text of each email.
* Whether an email is read or starred, as your mailbox shows it.
* The text of readable attachments, searched with the email. PDF and Word attachments need the
  [optional readers](/llms.mdx/docs/memo/notes/content.md#files-memo-can-read). After you install them, run
  `memo mail work import --retry-attachments` to read attachments that were skipped.
* Up to 1,000,000 characters of each email and 200,000 of each attachment
  ([change the limits](/llms.mdx/docs/memo/configuration/content.md#mail)).

Mail is prepared for search by meaning when the search model is on your computer; `--no-embed`
skips this.

## When mail is deleted [#when-mail-is-deleted]

When you delete an email in your mailbox, its text leaves the local store on the next import. Mail
moved to Spam counts as deleted. To protect you from mistakes:

* the first two days of the period are not checked for deletions;
* if a run finds an unusually large part of your mail missing, it deletes nothing and tells you.

## Mail and people [#mail-and-people]

To include a person's email in [their context](/llms.mdx/docs/memo/people/content.md#everything-about-a-person), link the
address to them in tg or max: `tg contacts link 'Kai Sample' email:kai@example.com`[↗](/llms.mdx/docs/tg/commands-personal/content.md#tg-contacts-link "Command reference: tg contacts link").

Next: [keep mail and notes up to date on a timer](/llms.mdx/docs/memo/archive/content.md).
