Skip to content

SMTP2GO

SMTP2GO works with pg_relay two ways: over the SMTP transport with a dashboard-created SMTP user, or over the webhook transport against its v3 email API with an API key. Keep either credential out of the database with an _env: reference (Keeping Secrets Out of the Database).

Over SMTP

{
  "host": "mail.smtp2go.com",
  "port": 2525,                               // 587 and 8025 also answer; 465 with "security": "tls"
  "security": "starttls",
  "auth": "plain",
  "username": "_env:SMTP2GO_USERNAME",        // an SMTP user created in the dashboard
  "password": "_env:SMTP2GO_PASSWORD",
  "from": "[email protected]",            // an address on a verified sender domain
  "timeout_seconds": 30
}

SMTP2GO's signature feature is the spread of ports — 2525, 587, and 8025 with STARTTLS, 465 with immediate TLS — so there is nearly always one an outbound firewall lets through. The credentials are an SMTP user created under Sending → SMTP Users in the dashboard, distinct from your dashboard login. The message block is the standard one from the SMTP chapter.

Over the REST API (webhook)

// profile
{
  "url": "https://api.smtp2go.com/v3/email/send",
  "auth": {"style": "custom_header", "header_name": "X-Smtp2go-Api-Key",
           "secret": "_env:SMTP2GO_API_KEY"},
  "timeout_seconds": 30
}

// message — SMTP2GO's own request shape, sent verbatim
{
  "sender": "[email protected]",
  "to": ["Ops Team <[email protected]>"],
  "subject": "disk alert",
  "text_body": "volume is filling",
  "html_body": "<p>volume is filling</p>"
}

The API key comes from Sending → API Keys in the dashboard. For SMTP2GO, have classify_webhook_response treat:

  • 200 as sent — the JSON body's data object reports succeeded and failed counts plus an email_id; return the email_id as the provider reference. (For belt-and-braces, a 200 whose data.failed is non-zero can be classified failed with the body's error detail.)
  • 429, any 5xx, and http_status = 0 (no response) as retry.
  • Any other 4xx as failed — a bad key, a malformed body, an unverified sender.

Things SMTP2GO enforces

from/sender should be on a verified sender domain (SPF and DKIM configured in the dashboard) for reliable delivery, and account plans carry a per-month sending allowance — exhausting it surfaces as rejections until the allowance renews or is raised.


Continue to Resend.