Files
Sentri/pub/api/classes/API_mailsettings.php
2026-01-01 10:54:18 +01:00

31 lines
1.5 KiB
PHP

<?php
namespace api\classes;
use api\classes\API;
require_once 'API.php';
class API_mailsettings extends API
{
public function updateMailSettings($updatePassword)
{
if ($updatePassword) {
$query = "UPDATE vc_portal_settings SET mail_from_name = ?, mail_from_address = ?, mail_smtp_host = ?, mail_smtp_secure = ?, mail_smtp_port = ?, mail_smtp_auth = ?, mail_smtp_user = ?, mail_smtp_pass = ? WHERE portal_uuid = ?";
$stmt = $this->prepareStatement($query);
$stmt->bind_param('ssssiisss', $this->data['mail_from_name'], $this->data['mail_from_address'], $this->data['mail_smtp_host'], $this->data['mail_smtp_secure'], $this->data['mail_smtp_port'], $this->data['mail_smtp_auth'], $this->data['mail_smtp_user'], $this->data['mail_smtp_pass'], $this->data['portal_uuid']);
} else {
$query = "UPDATE vc_portal_settings SET mail_from_name = ?, mail_from_address = ?, mail_smtp_host = ?, mail_smtp_secure = ?, mail_smtp_port = ?, mail_smtp_auth = ?, mail_smtp_user = ? WHERE portal_uuid = ?";
$stmt = $this->prepareStatement($query);
$stmt->bind_param('ssssiiss', $this->data['mail_from_name'], $this->data['mail_from_address'], $this->data['mail_smtp_host'], $this->data['mail_smtp_secure'], $this->data['mail_smtp_port'], $this->data['mail_smtp_auth'], $this->data['mail_smtp_user'], $this->data['portal_uuid']);
}
if ($this->executeStatement($stmt)) {
$this->apiOutput(200, ['success' => 'mail settings updated successfully.']);
}
}
}