<?php
$asunto = $_POST["asunto"];
$letter = $_POST["letter"];
$mails = $_POST["mails"];
$texto = $_POST["tipo"];
if ( $asunto != "" ) {
$i = 0;
$headers = "From: " . $_POST["nombre"];
$headers .= "<" . $_POST["mail"] . ">\r\n";
$headers .= "Content-Type: text/$texto\r\n";
$headers .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$mails = $_POST["mails"];
$todos = split("\r", $mails);
$contados = count($todos);
for($x=0; $x<$contados; $x++){
$to = $todos[$x];
mail($to, $asunto, $letter, $headers);
}
echo " <script>alert('As enviado $x mails'); </script> ";
echo '<script>';
echo 'location.href="";';
echo '</script>';
} else {
?>
<html>
<head>
<style type="text/css">
<!--
.naranja {color: #FF6633; font-weight: bold; }
.pagina {color: rgb(0, 164, 228);}
.juana {color: #FF6633; font-weight: bold; font-size: 18px; }
.Estilo7 {
color: rgb(0, 164, 228);
font-weight: bold;
font-size: 24px;
}
-->
</style>
<title>Mandar mails </title>
<body>
<form id="form1" name="form1" method="post" action="">
<div align="center" class="Estilo7">
<p>Mandar mails con php </p>
<p class="juana">Asunto :
<label>
<input name="asunto" type="text" class="pagina" id="asunto" />
</label>
Tu nombre :
<label></label>
<label>
<input name="nombre" type="text" class="pagina" id="nombre" />
</label>
Tu email :
<label>
<input name="mail" type="text" class="pagina" id="mail" />
</label>
</p>
<p class="juana">Texto a enviar &n bsp; &n bsp; &nbs p; Li sta de correos <br />
<label>
<textarea name="letter" cols="50" rows="12" id="letter"></textarea>
</label> &n bsp;
<label>
<textarea name="mails" cols="50" rows="12" id="mails">
[email protected]
[email protected]</textarea>
</label>
</p>
<div align="left" >
<p class="pagina">
<label> & nbsp; &nb sp;   ;
<input name="tipo" type="radio" value="plain" />
</label>
Sin html
<label>
<input name="tipo" type="radio" value="html" checked="checked" />
</label>
Con html </p>
</div>
<label>
<input type="submit" name="Submit" value="Enviar" />
</label>
</div>
</form>
</body>
</head>
</html>
<? } ?>