# PUT Mail settings
This PUT request updates the mail settings.

#### Location
```
/api/v1/portal-management/mail/configure/
```

#### Permissions required
`admin-mailsettings` RW

#### Body parameters
| Parameter         | Type    | Required | Description                                          |
| ----------------- | ------- | -------- | ---------------------------------------------------- |
| portal_uuid       | uuid    | yes      | Unique id of the portal.                             |
| mail_from_name    | string  | yes      | Mail from name.                                      |
| mail_from_address | email   | yes      | Mail from address.                                   |
| mail_smtp_host    | string  | yes      | SMTP FQDN hostname.                                  |
| mail_smtp_secure  | enum    | yes      | Secure connection type. Either `tls`, `ssl` or `no`. |
| mail_smtp_port    | integer | yes      | Mail server port number. Default `587` or `25`.      |
| mail_smtp_auth    | boolean | yes      | Use SMTP authentication.                             |
| mail_smtp_user    | string  | yes      | SMTP authentication user.                            |
| mail_smtp_pass    | string  | yes      | SMTP authentication password.                        |

### Example Body (json)
```json
{
        "portal_uuid": "11abc93d-c265-11f0-95da-7e99ed98b725",
        "mail_from_name": "Sentri Company",
        "mail_from_address": "sentri@company.com",
        "mail_smtp_host": "smtp.company.com",
        "mail_smtp_secure": "tls",
        "mail_smtp_port": 587,
        "mail_smtp_auth": true,
        "mail_smtp_user": "smtpuser",
        "mail_smtp_pass": "securepassword"
}
```

### Example Request
```php
$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => $baseUrl . '/api/v1/portal-management/mail/configure/',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => $json_payload,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . $token,
        'Content-Type: application/json',
        'X-HTTP-Method-Override: PUT'
    ],
]);

$response = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

if ($response === false) {
    echo curl_error($curl);
}

curl_close($curl);
```

### Example Response
```json
"mail settings updated successfully."
```

#### Known errors or issues.
None are known at the time
If you do encounter issues and get an http code in return, check the response codes on this page.