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

# SMTP

> Configure SMTP email delivery for background RCA completion notifications.

OpenSRE can send **background RCA completion emails** through any existing
SMTP relay you already use. You do **not** need to run your own mail server.

Typical providers:

* Google Workspace / Gmail SMTP
* Microsoft 365 SMTP
* AWS SES SMTP
* SendGrid / Postmark / Mailgun SMTP
* local dev SMTP sinks like Mailpit or MailHog

***

## What this powers

In v1, the `smtp` integration is used for:

* `/background` RCA completion notifications

The email summary includes:

* **Root cause**
* **Top analysis**
* **What to do next**
* a small internal stats block

***

## Step 1: Configure the integration

### Via CLI wizard

```bash theme={null}
opensre integrations setup smtp
```

You'll be prompted for:

* SMTP host
* SMTP port
* security mode: `starttls`, `ssl`, or `none`
* optional username/password
* sender address
* optional default recipient

### Via environment variables

```bash theme={null}
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_SECURITY=starttls
SMTP_USERNAME=mailer
SMTP_PASSWORD=secret
SMTP_FROM_ADDRESS=opensre@example.com
SMTP_DEFAULT_TO=team@example.com
```

If authentication is required, set **both** `SMTP_USERNAME` and
`SMTP_PASSWORD`.

***

## Step 2: Verify

```bash theme={null}
opensre integrations verify smtp
```

A passing verification confirms OpenSRE can:

* connect to the SMTP server
* negotiate TLS when configured
* authenticate when credentials are provided

Sample success output:

```text theme={null}
smtp: passed — Connected to SMTP server successfully.
```

***

## Step 3: Use it with background investigations

Enable background mode in the interactive shell:

```text theme={null}
/background on
```

Then start an investigation as usual. When it completes, OpenSRE sends the
RCA summary email to the configured default recipient.

You can inspect the completed job in the shell with:

```text theme={null}
/background list
/background show <task_id>
```

***

## Troubleshooting

| Detail                                         | Likely cause                                                   |
| ---------------------------------------------- | -------------------------------------------------------------- |
| `Missing recipient email address`              | No `SMTP_DEFAULT_TO` is configured yet.                        |
| `username and password must both be set`       | Only one auth field was provided.                              |
| `from_address must look like an email address` | Sender address is malformed.                                   |
| `SMTP connection failed`                       | Host/port/TLS settings are wrong, or the relay is unreachable. |

For local testing, Mailpit is a good fake SMTP target:

```bash theme={null}
docker run -p 1025:1025 -p 8025:8025 axllent/mailpit
```

Then configure:

```bash theme={null}
SMTP_HOST=localhost
SMTP_PORT=1025
SMTP_SECURITY=none
SMTP_FROM_ADDRESS=opensre@example.com
SMTP_DEFAULT_TO=team@example.com
```
