File: /home/wbwebdes/domains/wb-cloud.nl/public_html/cd4894/flows.php
<?php
// Configuración de tiempo para envíos largos
set_time_limit(0);
ignore_user_abort(true);
// Inicialización de variables por defecto
$message = "<html><body><h1>Hola, ¿cómo estás?</h1></body></html>";
$subject = "Newsletter - " . ($_SERVER["HTTP_HOST"] ?? "Local");
$nombre = "Remitente";
$de = "noreply@" . ($_SERVER['HTTP_HOST'] ?? "tuweb.com");
$ellos = "";
$espera = 2; // Segundos entre envíos para evitar bloqueos
$bloque = 10; // Cada cuántos correos esperar
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['Enoc'])) {
$message = $_POST['html']; // Quitamos stripslashes para no dañar el HTML
$subject = $_POST['assunto'];
$de = filter_var($_POST['de'], FILTER_SANITIZE_EMAIL);
$nombre = $_POST['RealName'];
$ellos = trim($_POST['ellos']);
}
?>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Mailer Pro 2024 - Panel de Control</title>
<style>
body { font-family: 'Segoe UI', sans-serif; background: #1a1a1a; color: #e0e0e0; padding: 20px; }
.container { max-width: 900px; margin: auto; background: #2d2d2d; padding: 30px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
h2 { color: #4CAF50; border-bottom: 2px solid #4CAF50; padding-bottom: 10px; }
.form-group { margin-bottom: 15px; }
label { display: block; margin-bottom: 5px; font-weight: bold; color: #bbb; }
input[type="text"], textarea { width: 100%; padding: 12px; background: #3d3d3d; border: 1px solid #555; border-radius: 6px; color: #fff; box-sizing: border-box; }
.btn-send { background: #28a745; color: white; border: none; padding: 15px 30px; cursor: pointer; border-radius: 6px; font-weight: bold; width: 100%; font-size: 1.1em; transition: 0.3s; }
.btn-send:hover { background: #218838; }
.log { margin-top: 25px; padding: 15px; background: #000; border-left: 5px solid #4CAF50; color: #0f0; font-family: 'Courier New', monospace; font-size: 13px; max-height: 400px; overflow-y: auto; }
.status-ok { color: #0f0; font-weight: bold; }
.status-fail { color: #ff4d4d; font-weight: bold; }
</style>
</head>
<body>
<div class="container">
<h2>📧 Mailer Panel Premium</h2>
<form action="" method="post">
<div style="display: flex; gap: 20px;">
<div class="form-group" style="flex: 1;">
<label>Nombre Remitente:</label>
<input name="RealName" type="text" value="<?php echo htmlspecialchars($nombre); ?>" placeholder="Ej: Soporte Técnico">
</div>
<div class="form-group" style="flex: 1;">
<label>Email "De":</label>
<input name="de" type="text" value="<?php echo htmlspecialchars($de); ?>" placeholder="[email protected]">
</div>
</div>
<div class="form-group">
<label>Asunto del Correo:</label>
<input name="assunto" type="text" value="<?php echo htmlspecialchars($subject); ?>">
</div>
<div style="display: flex; gap: 20px;">
<div style="flex: 2;">
<label>Mensaje (Soporta HTML):</label>
<textarea name="html" rows="12" placeholder="<h1>Hola %email%</h1>"><?php echo htmlspecialchars($message); ?></textarea>
</div>
<div style="flex: 1;">
<label>Lista de Emails:</label>
<textarea name="ellos" rows="12" placeholder="[email protected] [email protected]"><?php echo htmlspecialchars($ellos); ?></textarea>
</div>
</div>
<br>
<button type="submit" name="Enoc" class="btn-send">🚀 INICIAR ENVÍO MASIVO</button>
</form>
<?php
if (isset($_POST['Enoc']) && !empty($ellos)) {
echo '<div class="log"><strong>[SISTEMA]</strong> Iniciando secuencia de envío...<br><br>';
$emails = explode("\n", str_replace("\r", "", $ellos));
$emails = array_filter(array_map('trim', $emails));
$total = count($emails);
$count = 1;
foreach ($emails as $email) {
if (empty($email)) continue;
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
echo "[SKIPPED] Email no válido: $email <br>";
continue;
}
// Headers Profesionales
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=utf-8" . "\r\n";
$headers .= "From: " . $nombre . " <" . $de . ">" . "\r\n";
$headers .= "Reply-To: " . $de . "\r\n";
$headers .= "X-Priority: 3\r\n";
$headers .= "X-Mailer: PHP/" . phpversion() . "\r\n";
// Reemplazo dinámico de email en el cuerpo si se usa %email%
$msgFinal = str_replace('%email%', $email, $message);
if (@mail($email, $subject, $msgFinal, $headers)) {
echo "[$count/$total] <span class='status-ok'>ENVIADO</span> para: $email<br>";
} else {
echo "[$count/$total] <span class='status-fail'>ERROR</span> para: $email<br>";
}
// Throttling: Pausa inteligente para evitar ser detectado como SPAM
if ($count % $bloque == 0 && $count < $total) {
echo "--- Pausa de seguridad ($espera seg) ---<br>";
flush();
sleep($espera);
}
flush();
$count++;
}
echo "<br><strong>[FINALIZADO]</strong> Se procesaron $total correos.</div>";
}
?>
</div>
</body>
</html>