Ver Mensaje Individual
  #3 (permalink)  
Antiguo 07/05/2013, 16:52
Avatar de Briss
Briss
 
Fecha de Ingreso: junio-2011
Mensajes: 1.293
Antigüedad: 12 años, 10 meses
Puntos: 12
Respuesta: Error con phpmailer correo masivo

gracias mira asi envio mi email require("../phpmailer/class.phpmailer.php");
Código PHP:
if ($_POST['action'] == "send") {
    
$varname $_FILES['archivo']['name'];
    
$vartemp $_FILES['archivo']['tmp_name'];
     
     
$mail = new PHPMailer();
$mail->Host "localhost";

     
$email $_POST[email2];
    
$mensaje.= $_POST['mensaje']."\n\n";
    
    
// asunto del email
    
$subject $_POST[asunto];
    
$address $_POST[email2];
$mail->AddAddress($address"Probando");

 if (
$varname != "") {
        
$mail->AddAttachment($vartemp$varname);
    }
$mail->FromName "Plantel";
$mail->Subject $_POST['asunto'];
$address $_POST[email];

//$mail->AddAddress($address, "Probando");
$body .= $mensaje;
$mail->Body $body;
if(!empty( 
$file_name )) { 
$mail->AddAttachment($_FILES["archivo"]["tmp_name"], $_FILES["archivo"]["name"]);  } 
if(!
$mail->Send()) {
  echo 
"Mailer Error: " $mail->ErrorInfo;
} else {
  echo 
"¡Mensaje Enviado!";
}



y asi puse mi form

Código PHP:
if(!empty($_POST['email'])) {  
$aLista=$_POST['email'];  
mysql_select_db($database_connection$connection);
$sql.= "SELECT * FROM informesp where Folio IN (".implode(',',$aLista).")";  
$rsmysql_query($sql$connection) or die(mysql_error());
if(
mysql_num_rows($rs)>0)  
{    
  
    while(
$row mysql_fetch_assoc($rs)) 
    { 
 echo 
'<form action="" method="post" enctype="multipart/form-data">';
  


  
$Folio $Folio.$row["Email"].",";
          
          } 
        
$Folio substr($Folio0strlen($Folio)-1);
   
    echo 
'<input type="text" name="email[]"   value="'.$Folio.'"  />';





     



      echo 
' <tr valign="middle">';
       echo 
' <td height="45" ><div align="left"><font size="2">Asunto:</font></div></td>';
        echo 
'  <td height="45"><input type="text" name="asunto"   value=""  /></td>';
      echo 
'  </tr>';
      
      
      echo 
' <tr valign="middle">';
        echo 
' <td height="45" ><div align="left"><font size="2">Adjuntar archivo:</font></div></td>';
        echo 
'<input type="file" size="25" id="caja" name="archivo" style="width:400px"/>';
       echo 
'  </tr>';
        echo 
'<input type="text" name="email2"   value=""  />';
        
     echo 
' <tr valign="middle">';
       echo 
' <td height="45" ><div align="left"><font size="2">Mensaje:</font></div></td>';
        echo 
'  <td height="45"><textarea name="mensaje" cols="32"  ></textarea></td>';
      echo 
'  </tr>';
    echo 
'  <tr valign="baseline">';
  echo 
'  <td><input type="submit" value="Cancelar " /></td>';
      echo 
'  <td> <input type="image" name="btsend" src="img/CorreoE3Bn_r12_c9.png" border="0" id="btsend" alt="" /></td>';
   echo 
'   </tr>';
   echo 
'   </table>';
 
  echo 
'  <input type="hidden" name="action" value="send" />';
  echo 
'</form>'
Envio el Mensaje y me arroja el Mensaje

¡Mensaje Enviado!You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@hotmail.com)' at line 1

quite el for en email y bueno hice una prueba para enviar un solo email y si funiono pero aqui no supongo que me faltan algunas cosas :/