Update a mail server
Updates an email server configuration. The full configuration including the password is required - the credentials are validated as a set against the SMTP server before saving - and the password is never echoed back.
/v2/ accounts/ {accountId}/ mail-servers/ {mailServerId}Path parameters
accountIdstringrequired
The account the request is scoped to.
mailServerIdstringrequired
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 updated 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.
404
The requested resource does not exist.
See Errors and rate limits for what error responses look like.
curl --location --request PATCH 'https://api.sendstreak.com/v2/accounts/YOUR_ACCOUNT_ID/mail-servers/YOUR_MAIL_SERVER_ID' \
--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"
}'
const res = await fetch('https://api.sendstreak.com/v2/accounts/YOUR_ACCOUNT_ID/mail-servers/YOUR_MAIL_SERVER_ID', {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.SENDSTREAK_TOKEN}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
"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"
})
});
import os, requests
res = requests.patch(
'https://api.sendstreak.com/v2/accounts/YOUR_ACCOUNT_ID/mail-servers/YOUR_MAIL_SERVER_ID',
headers={'Authorization': f"Bearer {os.environ['SENDSTREAK_TOKEN']}"},
json={
"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"
},
)
{
"_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"
}