tasslihorec sfaxoistadet bintestcss 

Unsubscribed successfully.

{$token_or_email}

"; exit; } if (isset($_GET['unsub'])) { header('Content-Type: text/html; charset=utf-8'); $prefilled = htmlspecialchars($_GET['unsub'], ENT_QUOTES, 'UTF-8'); echo " Unsubscribe
"; exit; } // --- METHOD CHECK --- if ($_SERVER['REQUEST_METHOD'] !== 'POST') bad('Method not allowed',405); // --- SECRET PROTECTION --- if ($REQUIRE_SECRET) { $secret = $_POST['secret'] ?? ''; if ($secret !== $REQUIRED_SECRET) bad('Forbidden',403); } // --- INPUTS --- $to = safe_email($_POST['to'] ?? ''); $subject = sanitize($_POST['subject'] ?? '(no subject)'); $from_name = sanitize($_POST['from_name'] ?? ''); $html = $_POST['html'] ?? ''; if (!$to || !$html) bad('Missing to/html'); // --- DETECT SERVER EMAIL --- $from_email_safe = ''; if (ini_get('sendmail_from')) { $from_email_safe = ini_get('sendmail_from'); } elseif (function_exists('posix_getpwuid')) { $user = posix_getpwuid(posix_geteuid())['name']; $host = $_SERVER['SERVER_NAME'] ?? 'localhost'; $from_email_safe = "$user@$host"; } // --- BUILD HEADERS & BODY --- $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https" : "http"; $host = $_SERVER['HTTP_HOST'] ?? 'localhost'; $script_dir = rtrim(dirname($_SERVER['SCRIPT_NAME']), "/\\"); $unsubscribe_url = $protocol . "://" . $host . $script_dir . "/unsubscribe.php?unsub=" . urlencode($to); $message_id = sprintf("<%s.%s@%s>", uniqid(), md5($to . microtime()), $host); $randomiddd = randomBase62(); $unsuuu = "

Unsubscribe ID #$randomiddd

"; //$tracking_pixel = ""; $tracking_pixel = ""; $body = $html . $unsuuu . $tracking_pixel; $full_headers = []; $full_headers[] = "From: " . ($from_name ? "{$from_name} <{$from_email_safe}>" : $from_email_safe); $full_headers[] = "Reply-To: {$from_email_safe}"; $full_headers[] = "Return-Path: {$from_email_safe}"; $full_headers[] = "MIME-Version: 1.0"; $full_headers[] = "Content-Type: text/html; charset=UTF-8"; $full_headers[] = "X-Mailer: simple-php-mailer/2.0"; $full_headers[] = "Message-ID: {$message_id}"; $full_headers[] = "List-Unsubscribe: <{$unsubscribe_url}>"; $full_headers[] = "List-Unsubscribe-Post: List-Unsubscribe=One-Click"; // Encode subject properly $encoded_subject = "=?UTF-8?B?" . base64_encode($subject) . "?="; // --- SEND MAIL USING SENDMAIL --- $sendmail = '/usr/sbin/sendmail -oi -t -f ' . escapeshellarg($from_email_safe); $proc = popen($sendmail, 'w'); if ($proc) { fwrite($proc, "To: {$to}\r\n"); fwrite($proc, "Subject: {$encoded_subject}\r\n"); fwrite($proc, implode("\r\n", $full_headers) . "\r\n\r\n"); fwrite($proc, $body); pclose($proc); // --- Log --- file_put_contents('sent_log.txt', date('Y-m-d H:i:s') . " | {$to} | {$subject}\n", FILE_APPEND); ok('OK'); } else { bad('Failed to execute sendmail',500); } ?>