跳到主要内容

saveSmtpSettings

SmtpSettingsWrapper saveSmtpSettings(SmtpSettingsDto)

POST /api/2.0/smtpsettings/smtp

Save SMTP settings

Stores the SMTP relay that this portal will hand all of its own mail to, replacing whatever was saved before and taking the portal off the mail configuration of the installation. Nothing has to be called first; the caller needs the portal-settings right of a DocSpace administrator, and the SMTP settings section has to be enabled for the portal, otherwise the call is answered with 402. The call is mutating and idempotent - the same body saved twice leaves the same settings - and it applies to the next message the portal sends. The settings are stored unverified, no connection to host is attempted, so queue GET api/2.0/smtpsettings/smtp/test afterwards to find out whether they work. host and senderAddress must not be empty, senderDisplayName has to be present, and enableAuth true also requires credentialsUserName and credentialsUserPassword; a request that misses any of them is rejected and nothing is saved. port falls back to 25 when it is omitted, and useNtlm is accepted but not stored, so the saved settings always authenticate with a plain user name and password. The answer repeats the stored settings with the password emptied. Use DELETE api/2.0/smtpsettings/smtp to return to the configuration of the installation.

Parameters​

NameInTypeDescriptionNotes
SmtpSettingsDtobodySmtpSettingsDto[optional]

Responses​

Status codeDescriptionTypeResponse headers
200The SMTP settings now stored for the portal, with an empty passwordSmtpSettingsWrapperX-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
400The request body cannot be read, host or senderAddress is empty, senderDisplayName is missing, enableAuth is true without credentialsUserName or credentialsUserPassword, a text field is longer than 255 characters, or port is outside 1-65535--
402The SMTP settings section is not enabled for this portal--
403The caller has no portal-settings right--
401UnauthorizedErrorApiResponse-
429Too Many Requests.ErrorApiResponseRetry-After
500Internal Server Error.ErrorApiResponse-
502Bad Gateway. Returned by the reverse proxy, response body may be HTML and not JSON.--
503Service Unavailable. Returned by the reverse proxy, response body may be HTML and not JSON.--

Return type​

SmtpSettingsWrapper

Authorization​

Basic, OAuth2 (scopes: read, write), ApiKeyBearer, asc_auth_key, Bearer, OpenId

HTTP request headers​

  • Content-Type: application/json
  • Accept: application/json