Ver Mensaje Individual
  #1 (permalink)  
Antiguo 31/08/2010, 23:27
iambuxer
 
Fecha de Ingreso: abril-2010
Mensajes: 21
Antigüedad: 14 años
Puntos: 0
Email a todos mis usuarios por que no funciona?

Hola amigos.

Tengo un script PHP para enviar mails a mis usuarios pero no funciona.

El script es este:
Código:
$all=mysql_query("SELECT * FROM `users` WHERE `email`"); 

$to = "{$all}";

// "Subject:" line in the e-mail
$subject = ' subject here ';

// Message at the beginning of the e-mail body
$intro = "el cuerpo del mail\n\n";

// Mailer

	$msg .= "$intro\n";
	foreach ($_POST as $key => $string) {
		$value = stripslashes($string);
		if ($key == name) {
			$name = $value;
		}
		else if ($key == email) {
			$headers = "From: Sender Name <[email protected]>\r\n";
			$headers .= "Reply-To: <[email protected]>\r\n";
			$headers .= "Return-Path: <[email protected]>\r\n";
			$headers .= "Envelope-from: <[email protected]>\r\n";
			$headers .= "Content-Type: text/plain; charset=UTF-8\r\n";
			$headers .= "MIME-Version: 1.0\r\n";
		}		
	}
	mail($to, $subject, $msg, $headers);
	echo '<center><h1>Mail sent successfully.</h1></center>';

Espero me puedan ayudar.

Muchas gracias.

------------------------
Edito: Cuando en $to = "{$all}"; pongo $to = "[email protected]"; me llegan los mails.