Create a mail server

Connects a new email server. The SMTP connection and credentials are validated before saving, so a bad host or password fails fast instead of breaking email delivery later.

POST/v2/accounts/{accountId}/mail-servers

Base URL https://api.sendstreak.com. All v2 endpoints require a bearer token - see Authentication.

Path parameters

accountIdstringrequired

The account the request is scoped to.

Request body

Request body for creating or updating a mail server. Update is a PATCH but takes the complete object, password included - there is no partial update.

serviceTypestringrequired

Provider preset the server was configured from, e.g. awsses, gmail, or postmark.

hoststringrequired

SMTP host, e.g. email-smtp.eu-west-1.amazonaws.com for AWS SES.

portintegerrequired

SMTP port. Commonly 587, 465 or 25, but any port is accepted for a self-hosted server. The TLS mode is set by secure and requireTLS, not by the port.

securebooleanrequired

Connect with implicit TLS from the first byte. Independent of the port.

requireTLSbooleanrequired

Require a STARTTLS upgrade on a plaintext connection. Independent of the port.

allowInsecureTLSbooleanoptional

Skip TLS certificate verification for this server. Needed for a self-hosted server on a bare IP address or with a self-signed certificate, where no certificate can match the host. Leave unset (or false) for any hosted provider. This does not permit connections to private or link-local addresses, which are always refused.

userstringrequired

SMTP username.

passwordstringrequired

SMTP password. Write-only - it is masked on every read, so resend it on update.

defaultFromEmailstring (email)required

Sender address used by templates that set no fromEmail of their own. Must be an address this server is permitted to send as. Required on create and update: every server must be able to answer who a blank template sends as.

defaultFromNamestringrequired

Sender display name paired with defaultFromEmail. The pair is applied together: a template that sets its own fromEmail keeps its own name and never borrows this one.

Response

The created mail server (credentials masked).

Errors

400

The request body or parameters failed validation.

401

Missing or invalid token, or the token is not authorized for this account/user.

See Errors and rate limits for what error responses look like.

curl --location --request POST 'https://api.sendstreak.com/v2/accounts/YOUR_ACCOUNT_ID/mail-servers' \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
  "serviceType": "awsses",
  "host": "smtp.example.com",
  "port": 587,
  "secure": false,
  "requireTLS": false,
  "allowInsecureTLS": false,
  "user": "smtp-user",
  "password": "super-secret-password",
  "defaultFromEmail": "[email protected]",
  "defaultFromName": "Acme Team"
}'
response200application/json
{
  "_id": "665f0a2b1c9d440012ab34cd",
  "serviceType": "awsses",
  "host": "smtp.example.com",
  "port": 587,
  "secure": false,
  "requireTLS": false,
  "allowInsecureTLS": false,
  "user": "smtp-user",
  "password": "",
  "defaultFromEmail": "[email protected]",
  "defaultFromName": "Acme Team"
}