Ver Mensaje Individual
  #4 (permalink)  
Antiguo 26/05/2008, 15:18
Avatar de GatorV
GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años
Puntos: 2135
Respuesta: envio por mail de formulario dinamico

Hola shebita2003,

Prueba este código:
Código PHP:
<?php
if($_POST['enviar']=="Enviar") {
    function 
generartabla() {
            
ob_start();
        echo 
"<table style='float:none;width:200px;margin-top:50px;margin-left:20px;'>";
        while(list(
$key$Value) = each($_POST)){
            if (
$key != 'enviar'){
                if (
$key == 'email'){
                    echo 
"<tr>";
                    echo 
"<td style='font-weight:bold;'>"$key ." : </td><td>"$Value "</td>";
                    echo 
"</tr>";
                    echo 
"<tr>";
                    echo 
"<td style='font-weight:bold;'>&nbsp;</td><td>&nbsp;</td>";
                    echo 
"</tr>";
                } else {
                    echo 
"<tr>";
                    echo 
"<td style='font-weight:bold;'>"$key ." : </td><td>"$Value "</td>";
                    echo 
"</tr>";
                    echo 
"</tr>";
                }                
            } else {
                echo 
"<tr>";
                echo 
"<td style='font-weight:bold;'>&nbsp;</td><td>&nbsp;</td>";
                echo 
"</tr>";
                echo 
"</table>";
            }
        }
        
        return 
ob_get_clean();
    }

$correo="<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' />
<title>Untitled Document</title>
</head>

<body>
<table>
  
  <tr>
    <td>"
generartabla() ."</td>
  </tr>
</table>
</body>
</html>"
;

require 
"includes/class.phpmailer.php";

  
$mail = new phpmailer();

  
$mail->PluginDir "includes/";

  
$mail->Mailer "mail";

  
$mail->Host "smtp.xxx.com.ar";

  
$mail->SMTPAuth true;

  
$mail->Username "[email protected]"
  
$mail->Password "xxxx";

  
$mail->From "[email protected]";
  
$mail->FromName "Sitio Web";

  
$mail->Timeout=30;

  
$mail->AddAddress("[email protected]");

  
$mail->Subject "Presupuesto Online";
  
$mail->Body $correo;

  
$mail->AltBody "Mail en formato HTML";

  
$exito $mail->Send();

  
$intentos=1
  while ((!
$exito) && ($intentos 5)) {
    
sleep(5);
         
//echo $mail->ErrorInfo;
         
$exito $mail->Send();
         
$intentos=$intentos+1;    
    
   }
}