Files
wms-app/app/setting/api/engine/retrieve_smtp.php
T

33 lines
791 B
PHP

<?php
session_start();
require '../../../assets/utils/db_auth.php';
try {
$sth = $pdo1->prepare("
SELECT
server,
port,
username,
from_name,
from_email,
encryption
FROM company_smtp
WHERE company_id = :company_id
LIMIT 1
");
$sth->execute([':company_id' => $company_id]);
db_check($sth, $answer);
$row = $sth->fetch(PDO::FETCH_ASSOC);
$answer['success'] = 1;
$answer['output'] = $row ?: null; // null = not configured yet
} catch (Exception $e) {
$answer['message'] = $e->getMessage();
http_response_code(500);
}
exit(json_encode($answer));
?>