Foros del Web » Programando para Internet » PHP »

Modificar lista de correo

Estas en el tema de Modificar lista de correo en el foro de PHP en Foros del Web. q tal amigos? recientemente he necesitado una lista de correo pero lo mas sencilla posible y q no sea de terceros para así poder integrarla ...
  #1 (permalink)  
Antiguo 28/05/2008, 11:00
 
Fecha de Ingreso: noviembre-2003
Ubicación: Frente a la PC
Mensajes: 120
Antigüedad: 20 años, 5 meses
Puntos: 0
Información Modificar lista de correo

q tal amigos? recientemente he necesitado una lista de correo pero lo mas sencilla posible y q no sea de terceros para así poder integrarla a los websites sin q se vea fuera de diseño.

El cuento es q he encontrado un script al parecer sencillo el cual hace exactamente lo q yo quería, busca correos en una base de datos y envía los correos.

El detalle es q este script tiene dos modalidades de funcionar, por ejemplo:
1.- envía el correo a todos los suscritos
2.- envía el correo solo a los de un determinado país (seleccionado mediante una lista/menú)

el punto es que yo no necesito por ahora utilizar esas opciones, yo simplemente quiero enviárselo a todos los suscritos. El problema es que intente modificar el código para realizar esto pero no envía los correos, no se si cometí algún error ya que no soy experto en php.

Aquí los diferentes códigos....


CÓDIGO ORIGINAL:

Código PHP:
<?php
include("../../Connections/motos.php");
   if (!isset(
$_POST['submit'])):
?>

<html>
<head>
<title>Mailing List</title>
</head>

<body>

<form method="post" action="<?=$_SERVER['PHP_SELF']?>">
<table align="center" bgcolor="#D6DEE7" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<b><h2>MAILING LIST ADMIN</h2></b>


Send message to:
<select name="to" size="1" style="background-color: #F7F7F7">
<option selected value="all">Entire list
<option value="notall">By country
</select>

Country:
<select name="country" size="5">
<OPTION value="Argentina">Argentina
<OPTION value="Bolivia">Bolivia
<OPTION value="Brazil">Brazil
<OPTION value="Chile">Chile
<OPTION value="Colombia">Colombia
<OPTION value="Costa Rica">Costa Rica
<OPTION value="Ecuador">Ecuador
<OPTION value="Guatemala">Guatemala
<OPTION value="Honduras">Honduras
<OPTION value="Mexico">Mexico
<OPTION value="Nicaragua">Nicaragua
<OPTION value="Panama">Panama
<OPTION value="Paraguay">Paraguay
<OPTION value="Peru">Peru
<OPTION value="Puerto Rico">Puerto Rico
<OPTION value="Rep. Dominicana">Rep. Dominicana
<OPTION value="Uruguay">Uruguay
<OPTION value="Venezuela">Venezuela
</select>

Title or Subject: <input name="subject" type=text maxlength=100 size=40>
Message:
<textarea wrap name="message" rows=10 cols=45></textarea>
<input type=submit name="submit" value="SUBMIT">
</td>
</tr>
</table>
</form>
</body>
</html>

<?php else:

  
$to $_POST['to'];
  
$subject $_POST['subject'];
  
$message $_POST['message'];
  
$country $_POST['country'];

  if (
"all" == $to) {
   
$x 1;
   
$hold 50// quantity of emails sent before 3 sec delay
   
$emails mysql_query("SELECT email FROM members");
   while (
$sendemail mysql_fetch_array($emails)) {
   
$email $sendemail["email"];
   
mail($email$subject,
   
$message"From:Your name <[email protected]>");

   
$x++;
    if(
$x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout
    
sleep(3);
    
$x 0;
    }
   } 
// end of while loop
  
} else {
   
$bycountry mysql_query("SELECT email FROM members WHERE country = '$country'");
   while (
$countmail mysql_fetch_array($bycountry)) {
   
$email $countmail["email"];
   
$okemail mail($email$subject,
   
$message"From:Your name <[email protected]>");

   
$x++;
    if(
$x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout
    
sleep(3);
    
$x 0;
    }
   } 
// end of while loop
  
}
?>
<html>
<head>
</head>
<body>
SUCCESS!
</body>
</html>
<?php endif; ?>
Yo solamente tengo un un campo de texto llamado subject y un area de texto llamada message y este es mi codigo:

Código PHP:
<?php
include("../../Connections/motos.php");
   if (!isset(
$_POST['submit'])):
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>


</head>

<body>
<p>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post" name="form1" id="form1" onsubmit="MM_validateForm('subject','','R','message','','R');return document.MM_returnValue">
  <table width="53%" border="0" cellpadding="0" cellspacing="0" >
    <tr>
      <td width="21%"   ><div align="right">Sujeto:</div></td>
      <td colspan="3"><label>
        <input name="subject" type="text" id="subject" size="60" />
      </label></td>
    </tr>
    <tr>
      <td class="KT_th"><div align="right">Mensaje:</div></td>
      <td colspan="3"><label>
        <textarea wrap name="message" cols="60" rows="10" id="message"></textarea>
      </label></td>
    </tr>
    <tr>
      <td></td>
      <td width="11%"><label>
        <input type="submit" name="Submit" value="Enviar" />
      </label></td>
      <td width="13%"><label>
        <input type="button" name="Submit2" value="Cancelar" />
      </label></td>
      <td width="55%">&nbsp;</td>
    </tr>
  </table>
</form>
<p>&nbsp;</p>
</p>
</body>
</html>
<?php else:

  
//$to = $_POST['to'];
  
$subject $_POST['subject'];
  
$message $_POST['message'];
  
//$country = $_POST['country'];

  //if ("all" == $to) {
   
$x 1;
   
$hold 50// quantity of emails sent before 3 sec delay
   
$emails mysql_query("SELECT email FROM mailinglist");
   while (
$sendemail mysql_fetch_array($emails)) {
   
$email $sendemail["email"];
   
mail($email$subject,
   
$message"From: Nombre <[email protected]>");

   
$x++;
    if(
$x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout
    
sleep(3);
    
$x 0;
    }
   } 
// end of while loop
  //} 
  /*<?php ?>else {
   $bycountry = mysql_query("SELECT email FROM members WHERE country = '$country'");
   while ($countmail = mysql_fetch_array($bycountry)) {
   $email = $countmail["email"];
   $okemail = mail($email, $subject,
   $message, "From:Your name <[email protected]>");

   $x++;
    if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout
    sleep(3);
    $x = 0;
    }
   } // end of while loop
  }<?php */
  
  
?>

<html>
<head>
</head>
<body>
Enviado!
</body>
</html>
<?php endif; ?>


Mi base de datos tiene solo dos campos, id, email.

Agradezco cualquier ayuda q me puedan prestar para lograr q esto envíe los correos.

Gracias...
__________________
Sin sombra no hay luz...
  #2 (permalink)  
Antiguo 28/05/2008, 12:14
 
Fecha de Ingreso: enero-2008
Mensajes: 163
Antigüedad: 16 años, 3 meses
Puntos: 2
Respuesta: Modificar lista de correo

mmm no te aparece ningun error ni nada? la base de datos members ya no la utilizas?
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 21:47.