Method for Working with SMTP Server Settings

To work with SMTP server settings, execute requests using the "smtp" API method (determine administrator token before executing the request):

curl -v '<IP address or DNS server name>/api/v2/smtp/' --header 'Content-Type: application/json' -H 'Authorization: Bearer <administrator token>’

The example of response:

{
    "is_enabled": false,
    "host": "localhost",
    "port": 25,
    "timeout": null,
    "username": "",
    "sender": "noreply@localhost",
    "subject_prefix": "",
    "receivers": [],
    "test_email": ""
}

curl -X PUT -v '<IP address or DNS server name>/api/v2/smtp/' --header 'Content-Type: application/json' -H 'Authorization: Bearer <administrator token>' -d '{"is_enabled": <SMTP server connection indicator (true/false)>, "host": "<host>", "port": <port>, "timeout": <timeout>, "username": "<account login>", "password": "<account password>", "sender": "<sender email address>", "subject_prefix": "<prefix added to email topic>", "receivers": [<list of email receivers>]}'

The example of response:

{
    "is_enabled": true,
    "host": "localhost",
    "port": 25,
    "timeout": 40,
    "username": "superuser",
    "sender": "noreply@localhost",
    "subject_prefix": "license",
    "receivers": [
        {
            "id": 3,
            "email": "admin@example.com"
        }
    ],
    "test_email": ""
}

See also:

Server API