Foros del Web » Programando para Internet » PHP »

Como enviar mail de formulario con php en formato html

Estas en el tema de Como enviar mail de formulario con php en formato html en el foro de PHP en Foros del Web. Hola lo que quiero hacer es que en mi mail llegue el contenido del formulario en formato html y con css o sea que se ...
  #1 (permalink)  
Antiguo 11/07/2013, 11:29
Avatar de evolucion  
Fecha de Ingreso: julio-2013
Mensajes: 1
Antigüedad: 10 años, 9 meses
Puntos: 0
Pregunta Como enviar mail de formulario con php en formato html

Hola lo que quiero hacer es que en mi mail llegue el contenido del formulario en formato html y con css o sea que se muestre dentro de una tabla con colores y tamaño definido en fin con un estilo.

Lo que quiero es que las variables se envíen dentro del formato html pero no se como se pueden agregar.

Gracias

Código PHP:


   <?php
  
  $nombre
=$_POST['nombre'];
  
$fecha=$_POST['fecha'];
  
$telefono=$_POST['telefono'];
  
$mail=$_POST['mail'];
  
$comentarios=$_POST['comentarios'];
                       
                       
  
$conexion=mysql_connect("localhost","root","root");
 
 
  
mysql_select_db("taquiza2_taquizas",$conexion);

   
   
   
$consulta=mysql_query("SELECT * FROM taquiza where mail='$mail'");

   if(
mysql_num_rows($consulta)==0)

   {

       
    
mysql_query("INSERT INTO taquiza VALUES('$nombre','$fecha','$telefono','$mail')");
   }
   
   
$headers "From: ".$correo "\r\n";
   

   
   
   
$contenido '
   
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Documento sin título</title>
<style type="text/css">

p {
    margin:0;
    padding:20px 0 0 5px;
}

</style>
</head>

<body>
 
 
 
   <div style="width:700px; height:300px; margin:30px auto 0 auto; padding:0; font-family:Arial Black; font-size:12px; font-weight:bold;
   border:ridge 2px; font-size:14px; border-radius:10px; border-color:rgba(0,0,0,1);">
   
   
       <div style="width:100%; height:45px; background: rgba(255,204,0,.5); margin:0; padding:0; border-radius:8px 8px 0 0;">
       
           <div style="margin:0; width:100%; height:50%; text-align:center;">
     
               <h1 style="margin:0; padding:6px; font-size:22px;">Cotización Taquizas Bambini</h1>
       
           </div>
       
       </div>
       
       <div  style=" width:50%; height:255px; margin:0; padding:0; border-right:ridge 1px #000000; border-bottom-left-radius:7px; float:left;">
       
          <div style="width:100%; height:40px; margin:0; padding:0; background:rgba(255,255,255,1);">
          
         <p>Nombre:</p>
         
         </div>
         
          <div style="width:100%; background:rgba(244,244,244,.5); height:40px; margin:0; padding:0;">
          
          <p>Fecha del evento: </p>
          
          </div>
          
          
          <div style="width:100%; height:40px; margin:0; padding:0; background:rgba(255,255,255,1);">
          
            <p>Telefono: </p>
          
          </div>
         
          <div style="width:100%; background:rgba(244,244,244,.5); height:40px; margin:0; padding:0;">
          
            <p>Mail: </p>
          
          </div>
          
          <div style="width:100%; height:90px; margin:0; padding:0; background:rgba(255,255,255,1);">
          
            <p style="padding:70px 0 0 5px;">Comentarios:</p>
          
          </div>

       </div>
       
       
       
       <div id="col-der" style=" width:49%; border-bottom-right-radius:7px; height:255px; margin:0; padding:0; float: right;">
          
          <div style="width:100%; height:40px; margin:0; padding:0; background:rgba(255,255,255,1);">
          
            <p>$nombre</p>
          
          </div>
          
          <div style="width:100%; background:rgba(244,244,244,.5); height:40px; margin:0; padding:0;">
          
            <p>$fecha</p>
          
          </div>
          
          
          <div style="width:100%; height:40px; margin:0; padding:0; background:rgba(255,255,255,1);">
          
          <p>$telefono</p>
          
          </div>
         
          <div style="width:100%; height:40px; background:rgba(244,244,244,.5); margin:0; padding:0;">
          
          <p>$mail</p>
          
          </div>
          
          <div style="width:100%; margin:0; padding:0; background:rgba(255,255,255,1);">
          
            <p class="comentario">$comentarios</p>
          
          </div>
         
          
          
       </div>
   
   
   
   </div>


</body>
</html>

   
   '
;
   
$contenido .= "<strong>Nombre: </strong>".$nombre."<br/>" ;
   
$contenido .= "<strong>Num de tel:</strong> ".$fecha."<br/>";
   
$contenido .= "<strong>Telefono:</strong> ".$telefono."<br/>";
   
$contenido .= "<strong>Mail:</strong> ".$mail."<br/>";
   
$contenido .= "<strong>Comentarios:</strong> ".$comentarios."<br/>";
   
   
   
   
$headers  'MIME-Version: 1.0' "\r\n";
   
$headers .= 'Content-type: text/html; charset=iso-8859-1' "\r\n";
   
   
   if(
mail("[email protected]","Contacto de ",$contenido,$headers)){
        
$mensaje"<fieldset><legend>GRACIAS</legend><br/>Mensaje enviado <br/> <br/> pronto recibiras respuesta</fieldset>";
            
           }
           else{
           
$mensaje"Mensaje no enviado";}
           
           
mysql_close($conexion); 
   
 
?>

Etiquetas: formato, formulario, html, mail, mysql, select, sql, tabla, variables
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 00:12.