Email

With your own mail server, Streamtime emails the people who created a resource:

  • Resource health: when a resource they created becomes healthy or needs attention.
  • Alerts: when an alert starts or clears on a resource they created.
  • Weekly performance report for each cluster they created.

You choose which of these go out. Without a mail server, nothing is emailed; everything stays visible in the console.

Before you start

  • The mail server’s host name or IP address, its port and connection security: usually 587 with STARTTLS, or 465 with SSL/TLS.
  • A username and password, if the server needs a sign-in.
  • A From address the server allows Streamtime to send from.
  • The web address of your Streamtime console, for the links in emails.

The API examples below share this setup:

export STREAMTIME_TOKEN=<your-access-token>
export API=https://api.example.com/organizations/<org>
import os
from streamtime_sdk.client import AuthenticatedClient

client = AuthenticatedClient(
    base_url="https://api.example.com",
    token=os.environ["STREAMTIME_TOKEN"],
)
ORG = "<org>"

Uses the generated client in streamtime-sdk/typescript/client.

import { client } from "./client/client.gen";

client.setConfig({
  baseUrl: "https://api.example.com",
  headers: { Authorization: `Bearer ${process.env.STREAMTIME_TOKEN}` },
});
const org = "<org>";
package main

import (
    "bytes"
    "crypto/rand"
    "encoding/hex"
    "encoding/json"
    "net/http"
    "os"
)

const api = "https://api.example.com/organizations/<org>"

// newKey returns a random idempotency key.
func newKey() string {
    b := make([]byte, 16)
    rand.Read(b)
    return hex.EncodeToString(b)
}

// call sends one request with the access token and a JSON body (or none).
// An optional idempotency key is sent as the Idempotency-Key header.
func call(method, path string, body any, idempotencyKey ...string) (*http.Response, error) {
    var buf bytes.Buffer
    if body != nil {
        if err := json.NewEncoder(&buf).Encode(body); err != nil {
            return nil, err
        }
    }
    req, err := http.NewRequest(method, api+path, &buf)
    if err != nil {
        return nil, err
    }
    req.Header.Set("Authorization", "Bearer "+os.Getenv("STREAMTIME_TOKEN"))
    req.Header.Set("Content-Type", "application/json")
    if len(idempotencyKey) > 0 {
        req.Header.Set("Idempotency-Key", idempotencyKey[0])
    }
    return http.DefaultClient.Do(req)
}

Set up email

  1. Go to Settings → SMTP Email (also a step of first-time setup).
  2. Turn on Send notification emails.
  3. Under Mail server, enter SMTP server, Connection security, Port and, if needed, Timeout (seconds).
  4. Under Sign in, enter Username (optional) and Password, or leave both blank if the server accepts mail without signing in.
  5. Under Sender, enter From address, From name (optional) and Link address in emails.
  6. Under Which emails to send, choose resource health, alerts and the weekly performance report.
  7. Under Test the settings, select Send test email, then save.
curl -X PUT "$API/smtp-config/" \
  -H "Authorization: Bearer $STREAMTIME_TOKEN" -H "Content-Type: application/json" \
  -d '{"enabled": true, "host": "smtp.example.com", "port": 587,
       "encryption": "starttls", "username": "streamtime", "password": "<password>",
       "from_email": "streamtime@example.com", "from_name": "Streamtime",
       "link_base_url": "https://console.example.com",
       "status_emails_enabled": true, "alert_emails_enabled": true,
       "weekly_report_enabled": true}'

# Send a test (to the signed-in user if "to" is left out).
curl -X POST "$API/smtp-config/test/" \
  -H "Authorization: Bearer $STREAMTIME_TOKEN" -H "Content-Type: application/json" \
  -d '{"to": "you@example.com"}'

encryption is starttls, ssl or none. Leave password out to keep the saved one; send an empty value to remove it. The password is never returned.

from streamtime_sdk.api.email import (
    organizations_smtp_config_partial_update,
    organizations_smtp_config_test_create,
)
from streamtime_sdk.models import PatchedOrganizationSmtpConfig, SmtpTestRequest

organizations_smtp_config_partial_update.sync(
    ORG,
    client=client,
    body=PatchedOrganizationSmtpConfig.from_dict({
        "enabled": True,
        "host": "smtp.example.com",
        "port": 587,
        "encryption": "starttls",
        "from_email": "streamtime@example.com",
    }),
)
organizations_smtp_config_test_create.sync(
    ORG, client=client, body=SmtpTestRequest.from_dict({"to": "you@example.com"})
)
import {
  organizationsSmtpConfigPartialUpdate,
  organizationsSmtpConfigTestCreate,
} from "./client";

const path = { org_identifier: org };
await organizationsSmtpConfigPartialUpdate({
  path,
  body: {
    enabled: true,
    host: "smtp.example.com",
    port: 587,
    encryption: "starttls",
    from_email: "streamtime@example.com",
  },
});
await organizationsSmtpConfigTestCreate({ path, body: { to: "you@example.com" } });
resp, err := call("PATCH", "/smtp-config/", map[string]any{
    "enabled":    true,
    "host":       "smtp.example.com",
    "port":       587,
    "encryption": "starttls",
    "from_email": "streamtime@example.com",
})
if err != nil {
    return err
}
defer resp.Body.Close()
streamtime smtp set --enable --host smtp.example.com --port 587 --security starttls \
  --username streamtime --password --from-email streamtime@example.com \
  --link-address https://console.example.com \
  --status-emails --alert-emails --weekly-report
streamtime smtp test
streamtime smtp show

--password prompts for it; --password-stdin reads it from standard input.

MCP can read the settings (the get_smtp_config tool): “Is outbound email set up?” Changing them isn’t available in MCP.

variable "smtp_password" {
  type      = string
  sensitive = true
}

resource "streamtime_smtp_config" "mail" {
  enabled       = true
  host          = "smtp.example.com"
  port          = 587
  encryption    = "starttls"
  username      = "streamtime"
  password      = var.smtp_password
  from_email    = "streamtime@example.com"
  from_name     = "Streamtime"
  link_base_url = "https://console.example.com"
}
terraform import streamtime_smtp_config.mail smtp-config

An organization has one set of mail settings. terraform destroy stops managing them and leaves their current values in place. The password is kept in sensitive state and can’t be recovered by an import.

See streamtime_smtp_config.