menu
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.
Endpoint
POST https://api.sendstreak.com/v2/accounts/{accountId}/mail-servers
All v2 endpoints require a bearer token - see Authentication.
Path parameters
| Parameter | Type | Description |
|---|---|---|
accountId | string | The account the request is scoped to. |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
_id | string | no | |
serviceType | string | yes | Provider preset the server was configured from, e.g. awsses, gmail, or postmark. |
host | string | yes | SMTP host, e.g. email-smtp.eu-west-1.amazonaws.com for AWS SES. |
port | integer | yes | SMTP port - typically 587 (STARTTLS) or 465 (implicit TLS). |
secure | boolean | yes | Connect with implicit TLS (typically port 465). |
requireTLS | boolean | yes | Require a STARTTLS upgrade on plaintext connections (typically port 587). |
user | string | yes | SMTP username. |
password | string | yes | SMTP password. Write-only: required on create and update, masked on every read. |
Response
The created mail server (credentials masked).
{
"_id": "665f0a2b1c9d440012ab34cd",
"serviceType": "awsses",
"host": "smtp.example.com",
"port": 587,
"secure": false,
"requireTLS": false,
"user": "smtp-user",
"password": ""
}
Errors
| Status | Description |
|---|---|
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 example
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 '{
"_id": "665f0a2b1c9d440012ab34cd",
"serviceType": "awsses",
"host": "smtp.example.com",
"port": 587,
"secure": false,
"requireTLS": false,
"user": "smtp-user",
"password": "super-secret-password"
}'