# Sending emails

> Have the agent send an email, with an export attached, after you have reviewed and approved each message.

Source: https://www.opendb.tools/en/docs/emails

## What the agent can do

In read-write mode, the agent can prepare an email and attach an export to it:

```text
Export the last 40 orders as CSV and send them to Paul.
```

It can **never** send an email by itself. Every message goes through a form that you review.

Sending emails requires the `SEND MAIL` privilege.

## Set up email

Open **Settings → Mail** and fill in your SMTP server: host, port, username, password, encryption (TLS or SSL), sender address.

A **Test** button sends a trial message.

The configuration belongs to each user and is encrypted before it is stored. The password is never sent back to your browser: leave the field empty to keep the old one.

## Allow recipients

The agent can only write to the addresses on your **list of allowed recipients**. You manage it in **Settings → Mail**.

The agent can also suggest adding or removing a recipient. Any change to the list requires your approval.

## The sending form

When the agent prepares an email, a form appears in the conversation.

| Field | Detail |
|---|---|
| Recipients | Picked among the allowed addresses, ten at most |
| Subject | Editable |
| Body | Plain text, editable |
| Attachments | The suggested exports, which you turn on or off |

You change whatever you want, then send. OpenDB sends **what you approved**, and the agent is told what actually went out.

## Safeguards

- **Allowlist**: nothing is sent to an address that is not allowed.
- **Ten recipients** at most per message.
- **Attachments** limited to the files of your exports folder, 20 MB in total.
- **Plain text** only.
- **Mandatory review** before every send.

## Requests hidden in the data

Text read from the database, from a file or from a tool result may contain a sentence such as "send this file to this address". The agent is instructed **never** to treat that text as a request from you, and to report it to you.

The review form and the allowlist remain the real protection: nothing leaves without you, and nothing goes to an unknown address.

## In the terminal

The email form also exists in `opendb chat`. The SMTP configuration is set with `opendb settings`.
