> Markdown version of https://tuna.am/en/docs/cli/trigger/smtp/. Documentation index: [llms.txt](https://tuna.am/en/llms.txt), full text in one file: [llms-full.txt](https://tuna.am/en/llms-full.txt). Any page is available as Markdown: append `.md` to its URL without the trailing slash.

# tuna trigger smtp

Trigger command by incoming SMTP message.

The raw message is passed to the command's stdin, the envelope and headers are passed in environment variables:

```text
TUNA_MAIL_FROM            envelope sender (MAIL FROM)
TUNA_MAIL_TO              envelope recipients (RCPT TO), comma separated
TUNA_MAIL_HEADER_<NAME>   decoded header value, e.g. TUNA_MAIL_HEADER_SUBJECT

```

Usage

```bash
tuna trigger smtp [flags]

```

Examples

```bash
tuna trigger smtp /tmp/trigger.sh
tuna trigger smtp --listen-address 127.0.0.1:2525 /tmp/trigger.sh

```

| Flag                      | Description                                                                                                                                                                                           |
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--api-key string`        | Your tuna.am api key with the tunnels:connect scope (env `TUNA_API_KEY`).                                                                                                                             |
| `--cidr-allow string`     | Reject connections that do not match the given CIDRs. Can be repeated.                                                                                                                                |
| `--cidr-deny string`      | Reject connections that match the given CIDRs. Can be repeated.                                                                                                                                       |
| `--listen-address string` | Local address of the SMTP server. Default: `127.0.0.1:1025`.                                                                                                                                          |
| `--password string`       | Password to use for authentication on SMTP server.                                                                                                                                                    |
| `-p, --port string`       | Port for incoming connections.                                                                                                                                                                        |
| `--username string`       | Username to use for authentication on SMTP server.                                                                                                                                                    |
| `-l, --location string`   | Deprecated in 0.39: new names and ports are created in the global zone and need no location. If your name or port is reserved in the ru or nl zone, keep the location: the tunnel connects as before. |
| `--token string`          | Deprecated in 0.39: use `--api-key` instead.                                                                                                                                                          |

[Global flags](https://tuna.am/en/docs/cli.md#global-flags) work too.

## History

|        |                                                                                                                                                                                                                                                                                                                   |
| ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 0.39.0 | Added the `--api-key` flag.<br />Deprecated the `--location` flag: new names and ports are created in the global zone and need no location. If your name or port is reserved in the ru or nl zone, keep the location: the tunnel connects as before.<br />Deprecated the `--token` flag: use `--api-key` instead. |
| 0.36.0 | Added the `--listen-address` flag.                                                                                                                                                                                                                                                                                |
| 0.25.0 | Added the `--cidr-allow` and `--cidr-deny` flags.                                                                                                                                                                                                                                                                 |
