Files
wevads-platform/scripts/hamid-email.php
2026-02-26 04:53:11 +01:00

36 lines
1006 B
PHP
Executable File

<?php
header('Content-Type: application/json');
$pdo = new PDO('pgsql:host=localhost;dbname=adx_system', 'admin', 'admin123');
$pdo->exec("CREATE TABLE IF NOT EXISTS hamid_smtp_config (
id SERIAL PRIMARY KEY,
host VARCHAR(255),
port INT DEFAULT 587,
username VARCHAR(255),
password VARCHAR(255),
from_email VARCHAR(255),
from_name VARCHAR(255) DEFAULT 'HAMID IA',
active BOOLEAN DEFAULT true
)");
$action = $_POST['action'] ?? $_GET['action'] ?? '';
switch ($action) {
case 'send':
$to = $_POST['to'] ?? '';
$subject = $_POST['subject'] ?? '';
$body = $_POST['body'] ?? '';
$headers = "From: HAMID IA <hamid@wevads.com>\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
$result = @mail($to, $subject, $body, $headers);
echo json_encode(['success' => $result, 'to' => $to]);
break;
default:
echo json_encode(['actions' => ['send', 'configure']]);
}