Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/10/2007, 21:54
Avatar de Daam
Daam
 
Fecha de Ingreso: octubre-2007
Ubicación: Planeta Tierra
Mensajes: 152
Antigüedad: 16 años, 6 meses
Puntos: 0
Pregunta Envío de e-mail a múltiples destinatarios con PHP

Buenas noches,

Tengo un formulario con 12 entradas que consiste en el envío de un e-mail a las direcciones que coloco en los campos del formulario.

El código HTML del formulario es:

Código PHP:
<form id="form1" name="email_de_recordatorio" method="POST" action="accionmail.php" >
  <
br>
  <
br>
  <
p><img src="http://www.manasma.com/images/logo_solo.png" alt="Logo" width="372" height="76" /></p>
  <
p>&nbsp;</p>
  <
p align="left"><img src="http://www.forosdelweb.com/images/envio_email1_recordatorio.gif" alt="Env&iacute;o de 1&deg; e-mail de recordatorio" width="591" height="42" /></p>
  <
table width="940" border="0" align="center">
    <
tr>
      <
td height="23">1Enviar a: <span class="style1"></span></td>
      <
td><a onmouseover="Tip('Colocar e-mail del destinatario')"><img src="http://www.forosdelweb.com/images/tooltip.gif" alt="Tooltip" width="25" height="23" border="0" /></a>
          <
input name="recordatorio1" type="text" class="jsrequired" id="recordatorio1" tabindex="1"  maxlength="40" /></td>
    </
tr>
    <
tr>
      <
td height="23">2Enviar a: <span class="style1"></span></td>
      <
td><a onmouseover="Tip('Colocar e-mail del destinatario')"><img src="http://www.forosdelweb.com/images/tooltip.gif" alt="Tooltip" width="25" height="23" border="0" /></a>
          <
input name="recordatorio2" type="text" class="jsrequired" id="recordatorio2" tabindex="1"  maxlength="40" /></td>
    </
tr>
    <
tr>
      <
td height="23">3Enviar a: <span class="style1"></span></td>
      <
td><a onmouseover="Tip('Colocar e-mail del destinatario')"><img src="http://www.forosdelweb.com/images/tooltip.gif" alt="Tooltip" width="25" height="23" border="0" /></a>
          <
input name="recordatorio3" type="text" class="jsrequired" id="recordatorio3" tabindex="1"  maxlength="40" /></td>
    </
tr>
    <
tr>
      <
td height="23">4Enviar a: <span class="style1"></span></td>
      <
td><a onmouseover="Tip('Colocar e-mail del destinatario')"><img src="http://www.forosdelweb.com/images/tooltip.gif" alt="Tooltip" width="25" height="23" border="0" /></a>
          <
input name="recordatorio4" type="text" class="jsrequired" id="recordatorio4" tabindex="1"  maxlength="40" /></td>
    </
tr>
    <
tr>
      <
td height="23">5Enviar a: <span class="style1"></span></td>
      <
td><a onmouseover="Tip('Colocar e-mail del destinatario')"><img src="http://www.forosdelweb.com/images/tooltip.gif" alt="Tooltip" width="25" height="23" border="0" /></a>
          <
input name="recordatorio5" type="text" class="jsrequired" id="recordatorio5" tabindex="1"  maxlength="40" /></td>
    </
tr>
    <
tr>
      <
td height="23">6Enviar a: <span class="style1"></span></td>
      <
td><a onmouseover="Tip('Colocar e-mail del destinatario')"><img src="http://www.forosdelweb.com/images/tooltip.gif" alt="Tooltip" width="25" height="23" border="0" /></a>
          <
input name="recordatorio6" type="text" class="jsrequired" id="recordatorio6" tabindex="1"  maxlength="40" /></td>
    </
tr>
    <
tr>
      <
td height="23">7Enviar a: <span class="style1"></span></td>
      <
td><a onmouseover="Tip('Colocar e-mail del destinatario')"><img src="http://www.forosdelweb.com/images/tooltip.gif" alt="Tooltip" width="25" height="23" border="0" /></a>
          <
input name="recordatorio7" type="text" class="jsrequired" id="recordatorio7" tabindex="1"  maxlength="40" /></td>
    </
tr>
    <
tr>
      <
td height="23">8Enviar a: <span class="style1"></span></td>
      <
td><a onmouseover="Tip('Colocar e-mail del destinatario')"><img src="http://www.forosdelweb.com/images/tooltip.gif" alt="Tooltip" width="25" height="23" border="0" /></a>
          <
input name="recordatorio8" type="text" class="jsrequired" id="recordatorio8" tabindex="1"  maxlength="40" /></td>
    </
tr>
    <
tr>
      <
td height="23">9Enviar a: <span class="style1"></span></td>
      <
td><a onmouseover="Tip('Colocar e-mail del destinatario')"><img src="http://www.forosdelweb.com/images/tooltip.gif" alt="Tooltip" width="25" height="23" border="0" /></a>
          <
input name="recordatorio9" type="text" class="jsrequired" id="recordatorio9" tabindex="1"  maxlength="40" /></td>
    </
tr>
    <
tr>
      <
td height="23">10Enviar a: <span class="style1"></span></td>
      <
td><a onmouseover="Tip('Colocar e-mail del destinatario')"><img src="http://www.forosdelweb.com/images/tooltip.gif" alt="Tooltip" width="25" height="23" border="0" /></a>
          <
input name="recordatorio10" type="text" class="jsrequired" id="recordatorio10" tabindex="1"  maxlength="40" /></td>
    </
tr>
    <
tr>
      <
td height="23">11Enviar a: <span class="style1"></span></td>
      <
td><a onmouseover="Tip('Colocar e-mail del destinatario')"><img src="http://www.forosdelweb.com/images/tooltip.gif" alt="Tooltip" width="25" height="23" border="0" /></a>
          <
input name="recordatorio11" type="text" class="jsrequired" id="recordatorio11" tabindex="1"  maxlength="40" /></td>
    </
tr>
    <
tr>
      <
td height="23">12Enviar a: <span class="style1"></span></td>
      <
td><a onmouseover="Tip('Colocar e-mail del destinatario')"><img src="http://www.forosdelweb.com/images/tooltip.gif" alt="Tooltip" width="25" height="23" border="0" /></a>
          <
input name="recordatorio12" type="text" class="jsrequired" id="recordatorio12" tabindex="1"  maxlength="40" /></td>
    </
tr>
    <
tr>
      <
td width="308" height="23">13Enviar a: <span class="style1"></span></td>
      <
td width="622"><a onmouseover="Tip('Colocar e-mail del destinatario')"><img src="http://www.forosdelweb.com/images/tooltip.gif" alt="Tooltip" width="25" height="23" border="0" /></a>
      <
input name="recordatorio13" type="text" class="jsrequired" id="recordatorio13" tabindex="1"  maxlength="40" /></td>
    </
tr>
  </
table>
  
  <
tr><div align="center"><input name="enviar" type="submit" id="Registrar" tabindex="9"  value="Enviar" />
  </
div>
  
</
form
El código del archivo accionmail.php es:

Código PHP:
<?
$para  
'$recordatorio1,$recordatorio2,$recordatorio3,$recordatorio4,$recordatorio5,$recordatorio6,$recordatorio7
,$recordatorio8,$recordatorio9,$recordatorio10,$recordatorio11,$recordatorio12'

$asunto "Este mensaje es de prueba";
$cuerpo '
<html>
<head>
   <title>Prueba de correo</title>
</head>
<body>
<h1>Hola amigos!</h1>
<p>
<b>Bienvenidos a mi correo electrónico de prueba</b>. Estoy encantado de tener tantos lectores. Este cuerpo del mensaje es del artículo de envío de mails por PHP. Habría que cambiarlo para poner tu propio cuerpo. Por cierto, cambia también las cabeceras del mensaje.
</p>
</body>
</html>
'
;

//para el envío en formato HTML
$headers "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

//dirección del remitente
$headers .= "From: Atencion al cliente <[email protected]>\r\n";

//direcciones que recibirán copia oculta
$headers .= "Bcc: [email protected]\r\n";

mail($para,$asunto,$cuerpo,$headers);
?>
Este código tiene muchos problemas ya que eventualmente se envía los correos a todos los usuarios y en otras ocasiones no.

¿De qué manera puedo hacer para que el e-mail se envíe a todas las direcciones que coloque en el formulario?

Espero su colaboración

Última edición por Daam; 26/10/2007 a las 19:11