"ok", "service" => "WEVIA LIFE Email", "capabilities" => ["send", "read", "list_boxes"]]); break; case "list_boxes": echo json_encode(["boxes" => [ ["email" => "ymahboub@weval-consulting.com", "type" => "cPanel/IMAP", "status" => "active"], ["email" => "yacineutt@gmail.com", "type" => "Gmail/SMTP", "status" => "configured"], ["email" => "contact@weval-consulting.com", "type" => "cPanel/IMAP", "status" => "active"], ]]); break; case "send": $to = $input["to"] ?? ""; $subject = $input["subject"] ?? "Message WEVIA"; $body = $input["body"] ?? ""; $from = $input["from"] ?? "ymahboub@weval-consulting.com"; if (empty($to) || empty($body)) { echo json_encode(["error" => "to and body required"]); exit; } // Use PHP mail() with custom headers $headers = "From: WEVIA <$from>\r\n"; $headers .= "Reply-To: $from\r\n"; $headers .= "Content-Type: text/html; charset=UTF-8\r\n"; $headers .= "X-Mailer: WEVIA-LIFE/2.0\r\n"; $htmlBody = "
"; $htmlBody .= nl2br(htmlspecialchars($body)); $htmlBody .= "