Foros del Web » Programando para Internet » PHP »

ENVIAR POR CORREO FORMULARIO PHP con formato HTML

Estas en el tema de ENVIAR POR CORREO FORMULARIO PHP con formato HTML en el foro de PHP en Foros del Web. Hola muchachos! como andan??.. uds. son mi biblia!!! jejeje.. los molesto por lo siguiente: tengo un formulario de contacto en php el tema está que ...
  #1 (permalink)  
Antiguo 18/10/2008, 17:36
 
Fecha de Ingreso: agosto-2008
Mensajes: 9
Antigüedad: 15 años, 8 meses
Puntos: 0
Exclamación ENVIAR POR CORREO FORMULARIO PHP con formato HTML

Hola muchachos! como andan??.. uds. son mi biblia!!! jejeje.. los molesto por lo siguiente:
tengo un formulario de contacto en php el tema está que quiero que me llegue como me viene llegando, perfecto, pero que los datos que se detallan queden en NEGRITA y lo que se ingreso en letra normal, es decir:

Nombre: Nicolas de Leon
¿se entiende?

aca tengo el formulario... a ver si me ayudan y me dicen que tengo que agregar a todo este codigo que acutalmente tengo.

GRACIAS POR TODO! UN GRAN SALUDO!
Nicolás.
==============================================

$nombre = $_POST['nombre'];
$telefono2 = $_POST['telefono2'];
$email = $_POST['email'];
$Detalle = $_POST['Detalle'];
$entero = $_POST['entero'];

if ($nombre)
{
$asunto = "Mensaje desde sitio web";
$escribio = nl2br($comentario);

//cuerpo del mensaje...

$mensaje = "Mensaje desde sitio web.

Datos ingresados:

Nombre: ".$nombre."
Num de tel: ".$telefono2."
Email: ".$email."

Mensaje enviado:

Mensaje: ".$Detalle."
Como se entero de nosotros?: ".$entero."";

mail("[email protected]", $asunto, $mensaje, "From: $nombre <$email>");

==================================================
  #2 (permalink)  
Antiguo 18/10/2008, 18:28
 
Fecha de Ingreso: mayo-2008
Mensajes: 64
Antigüedad: 15 años, 10 meses
Puntos: 0
Respuesta: ENVIAR POR CORREO FORMULARIO PHP con formato HTML

prueba esto:

Código PHP:
<?php
$nombre 
$_POST['nombre'];
$telefono2 $_POST['telefono2'];
$email $_POST['email'];
$Detalle $_POST['Detalle'];
$entero $_POST['entero'];
$para  "[email protected]";


// asunto
$asunto "Mensaje desde sitio web";

//MENSAJE
$mensaje "<strong>Nombre: </strong>".$nombre."<br>" ;
$mensaje .= "<strong>Num de tel:</strong> ".$telefono2."<br>";
$mensaje .= "<strong>Email:</strong> ".$email."<br>";

// Para enviar correo HTML, la cabecera Content-type debe definirse
$cabeceras  'MIME-Version: 1.0' "\r\n";
$cabeceras .= 'Content-type: text/html; charset=iso-8859-1' "\r\n";

// Cabeceras adicionales
$cabeceras .= 'From: quien lo envia' "\r\n";

$mensaje_enviado mail($para$asunto$mensaje$cabeceras);
if(
$mensaje_enviado)
{
echo 
"MENSAJE ENVIADO";
}
else
{
echo 
"MENSAJE NO ENVIADO, VUELVA A INTENTARLO EN UNOS INSTANTES";
}
?>
No he usado todas las variables, simplemente has de seguir el $mensaje .=, igual que he hecho yo con todas.

un saludo y espero haberte sido de ayuda

Última edición por DjCasius; 18/10/2008 a las 18:46 Razón: falta de texto
  #3 (permalink)  
Antiguo 20/10/2008, 06:28
 
Fecha de Ingreso: agosto-2008
Mensajes: 9
Antigüedad: 15 años, 8 meses
Puntos: 0
Respuesta: ENVIAR POR CORREO FORMULARIO PHP con formato HTML

lamentablemente no me funciona, me dice que el mensaje esta enviado, pero no me muestra los campos a llenar.


GRACIAS DE TODO MODOS! SALUDOS.
  #4 (permalink)  
Antiguo 20/10/2008, 07:14
 
Fecha de Ingreso: mayo-2008
Mensajes: 64
Antigüedad: 15 años, 10 meses
Puntos: 0
Respuesta: ENVIAR POR CORREO FORMULARIO PHP con formato HTML

eso es que pasas mal las variables.
  #5 (permalink)  
Antiguo 20/10/2008, 17:28
 
Fecha de Ingreso: agosto-2008
Mensajes: 9
Antigüedad: 15 años, 8 meses
Puntos: 0
Respuesta: ENVIAR POR CORREO FORMULARIO PHP con formato HTML

y como lo soluciono, no enteindo nada en php!!!

gracias y sorry por la joda!!

nicolas
  #6 (permalink)  
Antiguo 28/10/2008, 05:13
Avatar de freemanworld  
Fecha de Ingreso: agosto-2008
Mensajes: 191
Antigüedad: 15 años, 8 meses
Puntos: 0
Respuesta: ENVIAR POR CORREO FORMULARIO PHP con formato HTML

El formulario es para un Linux o un Windows?
  #7 (permalink)  
Antiguo 28/10/2008, 16:51
okram
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: ENVIAR POR CORREO FORMULARIO PHP con formato HTML

Cita:
Iniciado por salocindeleon Ver Mensaje
y como lo soluciono, no enteindo nada en php!!!
Ajá, por ahí debiste empezar.

Lee un manual de PHP, pues el envío de correos es un tema algo complicado de entender e implementar si no tienes los conocimientos básicos sobre PHP. Te recomiendo leer el manual oficial de PHP. http://www.php.net/mail

Si no haces eso primero, todo lo que aquí se te dice será por gusto. El código que te dió DjCasius debe funcionarte. Cuál es el problema? No envía los correos? Llegan vacíos?

Saludos,
  #8 (permalink)  
Antiguo 28/10/2008, 17:42
Avatar de freemanworld  
Fecha de Ingreso: agosto-2008
Mensajes: 191
Antigüedad: 15 años, 8 meses
Puntos: 0
Respuesta: ENVIAR POR CORREO FORMULARIO PHP con formato HTML

A mi si me dice si es para linux o para Windows le puedo poner un ejemplo....

Este teoricamente le vale para los dos:

Primero debemos de tener dos archivos:
-contacto.htm
-gracias.php


Para contacto.html:

Código PHP:
<form action="gracias.php" method="post" name="form1" target="_self">
                                       
      <
table width="330" height="300" border="0" align="center" cellpadding="0" cellspacing="0" >
     <
tr>
          <
td height="40" colspan="3" class="estilo5"><p>&nbsp;</p>
            <
p><font color="#FFFFFF">Rellene los siguientes campos (* campos obligatorios)</font></p></td>
          </
tr>
          <
tr>
          <
td width="128" height="10"><div align="left"><span class="estilo5">
            <
font color="#FFFFFF">
            <
img src="images/cuadro_negro.jpg" width="4" height="4"> &nbsp;Nombre y apellidos*
            </
font> </span></div></td>
          <
td width="4"></td>
          <
td width="198"><input name="nombre" type="text" id="nombre"  style="font-size:11px " size="30" ></td>
        </
tr>
        <
tr>
          <
td width="128" height="10"><div align="left"><span class="Estilo4">
            <
font color="#FFFFFF">
            <
img src="images/cuadro_negro.jpg" width="4" height="4"> &nbsp;</font></span><span class="estilo5"><font color="#FFFFFF">Empresa</font></span></div></td>
          <
td width="4"></td>
          <
td width="198"><input name="empresa" type="text" id="empresa"  style="font-size:11px " size="30" ></td>
        </
tr>
        <
tr>
          <
td width="128" height="10"><div align="left"><span class="Estilo4">
            <
font color="#FFFFFF">
            <
img src="images/cuadro_negro.jpg" width="4" height="4">&nbsp;
            </
font> </span><span class="estilo5"><font color="#FFFFFF">Poblaci&oacute;n</font></span></div></td>
          <
td></td>
          <
td width="198"><input name="poblacion" type="text" id="poblacion"  style="font-size:11px " size="30" ></td>
        </
tr>
        <
tr>
          <
td width="128" height="10"><div align="left"><span class="Estilo4">
            <
font color="#FFFFFF">
            <
img src="images/cuadro_negro.jpg" width="4" height="4">&nbsp;
            </
font> </span><span class="estilo5"><font color="#FFFFFF">Provincia</font></span></div></td>
          <
td></td>
          <
td width="198"><input name="provincia" type="text" id="provincia"  style="font-size:11px " size="30" ></td>
        </
tr>
        <
tr>
          <
td width="128" height="10"><div align="left"><span class="Estilo4">
            <
font color="#FFFFFF">
            <
img src="images/cuadro_negro.jpg" width="4" height="4"> &nbsp;</font></span><span class="estilo5"><font color="#FFFFFF">Tel&eacute;fono*</font></span></div></td>
          <
td></td>
          <
td width="198"><input name="telefono" type="text" id="telefono"  style="font-size:11px " size="30" ></td>
        </
tr>
        <
tr>
          <
td width="128" height="10"><div align="left"><span class="Estilo4">
            <
font color="#FFFFFF">
            <
img src="images/cuadro_negro.jpg" width="4" height="4"> &nbsp;</font></span><span class="estilo5"><font color="#FFFFFF">E</font><font color="#FFFFFF">mail</font></span></div></td>
          <
td></td>
          <
td width="198"><input name="email" type="text" id="email"  style="font-size:11px " size="30" ></td>
        </
tr>
        <
tr>
          <
td height="20"><div align="left"><span class="Estilo4">
            <
font color="#FFFFFF">
            <
img src="images/cuadro_negro.jpg" width="4" height="4"> &nbsp;</font></span><span class="estilo5"><font color="#FFFFFF">Comentarios</font></span></div></td>
          <
td></td>
          <
td rowspan="2" valign="middle"><textarea name="comentarios" cols="30" rows="5" class="caja" id="comentarios"></textarea></td>
        </
tr>
        <
tr>
          <
td height="50"></td>
          <
td></td>
          </
tr>
        <
tr>
          <
td height="5"></td>
          <
td></td>
          <
td><table width="198" border="0" cellspacing="0" cellpadding="0">
            <
tr>
              <
td><input name="Submit" type="submit" class="BTN" value="enviar"></td>
              <
td width="15">&nbsp;</td>
            </
tr>
          </
table></td>
        </
tr>
       
      </
table>
</
form
A continuación veremos el de gracias.php

En gracias.php:

Código PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Formulario</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META HTTP-EQUIV="refresh" CONTENT="4; url=http://www.freemanworld.es">

<script type="text/javascript" language="JavaScript1.2" src="stm31.js"></script>
<script language="JavaScript" type="text/JavaScript">
<!--



function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>

<link href="estilos.css" rel="stylesheet" type="text/css">



<?
        $cuerpo  
"nombre: $nombre\n";
        
$cuerpo .= "empresa: $empresa\n";
        
$cuerpo .= "poblacion: $poblacion\n";
      
$cuerpo .= "provincia: $provincia\n";
      
$cuerpo .= "email: $email\n";
      
$cuerpo .= "telefono: $telefono\n";      
      
$cuerpo .= "comentarios: $comentarios\n";

      

        
mail("(tu correo)""Formulario Web"$cuerpo$adicionales); ----Por ejemplomail("[email protected]""Formulario Web"$cuerpo$adicionales);
?>






<style type="text/css">
<!--
.Estilo2 {color: #666666}
-->
</style>
</head>

<body leftmargin="0" topmargin="0">
<table width="750"  border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="750"><table width="100%"  border="0" cellspacing="0" cellpadding="10">
        <tr>
          <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td class="submenuizquierdo Estilo2"><div align="center">
                  <p>Su e-mail ha sido correctamente enviado. </p>
                  <p>En breve ser&aacute; redireccionado a nuestra p&aacute;gina</p>
                </div></td>
              </tr>
          </table></td>
        </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
Acuerdate de cambiar los datos que necesites...es decir, donde ponga una URL pon la tuya y demás....

Con esto, subimos los dos archivos a nuestro ftp (donde corresponda) y probamos.
Cuando esté funcionando lo podemos adornar para que quede más presentable.

Un saludo

Fuente: Foro
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 07:05.