Ver Mensaje Individual
  #3 (permalink)  
Antiguo 26/05/2008, 15:05
shebita2003
 
Fecha de Ingreso: mayo-2008
Mensajes: 3
Antigüedad: 15 años, 10 meses
Puntos: 0
Respuesta: envio por mail de formulario dinamico

gracias gator por contestar, estoy usando el envio de mail por smtp, para generar un mail con formato html, el código es el siguiente:

Código PHP:
<?php
if($_POST['enviar']=="Enviar"){

function 
generartabla() {
    
            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>";
                }
            }
        
       
}

$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;    
    
   }
}
Y ACA EMPIEZA EL CÓDIGO DE LA PAGINA QUE RECIBE EL FORMULARIO, CON UNA RESPUESTA COMO "SU PRESUPUESTO FUE ENVIADO, EN BREVE NOS COMUNICAREMOS CON USTED, MUCHAS GRACIA"
Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html ...