Sí el Newsletter es el mismo para todos, me sirve lo que me dieron pero como debería intercalar la funcion de sleep si quiero que se detenga 3 segundos entre cada envio? ej: sleep(3000)
Entendí que es para contar cuantos mails tengo esta función:
Código PHP:
<? $archivo = file("archivo.txt"); $lineas = count($archivo); for($i=0; $i < $lineas; $i++){ echo $archivo[$i]; } ?>
El PHP de envio de emails sería este:
Código PHP:
<?PHP
function GetIP()
{
if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"),"unknown"))
$num = getenv("HTTP_CLIENT_IP");
else if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown"))
$num = getenv("HTTP_X_FORWARDED_FOR");
else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown"))
$num = getenv("REMOTE_ADDR");
else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown"))
$num = $_SERVER['REMOTE_ADDR'];
else
$num = "unknown";
return($num);
}
$destinatario = $_POST["email"];
$num= GetIp();
$dia=date("d.m.Y");
$hora=date("H:i:s");
$cuerpo = '
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>NewsLetter</title>
</head>
<body>
<table border="0" width="100%" height="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" valign="top">
<u><strong>NewsLetter de </strong> '.$dia.' <strong>a las</strong>
'.$hora.' </p>
<td>
</tr>
</table>
</body>
</html>
';
mail($destinatario,'Newsletter',$cuerpo,"FROM:- MiWeb -<[email protected]>\nMIME-Version: 1.0\nContent-type: text/html; charset=iso-8859-1\nX-Priority: 3\nX-MSMail-Priority: High");
?>
Como escribí anteriormente el archiv.txt tiene los e-mails uno abajo del otro.