| Portada | Monotemáticos | Secciones | Desarrolladores | Comunidad | Servicios | Servicios profesionales | RSS | ||||
| FAQ: Envío de mails con PHP |
Se muestra un comentario sin revisar
| Jose Rafael | 09/3/07 |
| Buenos Dias, he creado un formulario con Photoshop, luego lo lleve a Fireworks para cortar las partes en donde va el formulario y luego lo lleve a dreamweaver para crear el formulario. Despues de esto he creado el archivo PhP para que procese la informacion. Una vez hecho esto subi los archivos al servidor he hice una pruba llenando el formulario pero al llegarme la informacion a mi correo los datos del usuario me llegan todos en blanco. Tambien instale Oscommerece en mi pagina la cual ya tiene una opcion de contacto y la probe y funciona perfectamente. De esa manera que da descartada una falla en el servidor. Nose que pueda estar pasando ya que no soy experto y necesito que alguien me ayude para poder habilitarlo. Aca dejo la direccion web del formulario [url=http://www.compushock.com/mercadolibre/form/index.htm]Formulario de Envio[/url]. Ahora colocare tanto el codigo del formulario en Html como el de Php. Codigo Html del Formulario [code]<html> <head> <title>Formulario de Envío</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <!--Fireworks MX 2004 Dreamweaver MX 2004 target. Created Thu Mar 08 15:59:00 GMT-0400 2007--> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } --> </style> </head> <body bgcolor="#ffffff"> <div align="center"> <table border="0" cellpadding="0" cellspacing="0" width="800"> <!--DWLayoutTable--> <!-- fwtable fwsrc="Form.png" fwbase="index.png" fwstyle="Dreamweaver" fwdocid = "1530473965" fwnested="0" --> <tr> <td height="1"><img src="images/spacer.gif" width="133" height="1" border="0" alt=""></td> <td><img src="images/spacer.gif" width="12" height="1" border="0" alt=""></td> <td colspan="2"><img src="images/spacer.gif" width="252" height="1" border="0" alt=""></td> <td width="19"><img src="images/spacer.gif" width="19" height="1" border="0" alt=""></td> <td width="27"><img src="images/spacer.gif" width="27" height="1" border="0" alt=""></td> <td width="21"><img src="images/spacer.gif" width="21" height="1" border="0" alt=""></td> <td width="207"><img src="images/spacer.gif" width="207" height="1" border="0" alt=""></td> <td width="33"><img src="images/spacer.gif" width="33" height="1" border="0" alt=""></td> <td width="53"><img src="images/spacer.gif" width="53" height="1" border="0" alt=""></td> <td><img src="images/spacer.gif" width="43" height="1" border="0" alt=""></td> <td><img src="images/spacer.gif" width="1" height="1" border="0" alt=""></td> </tr> <tr> <td height="164"><img src="images/index_r1_c1.png" alt="" name="index_r1_c1" width="133" height="164" border="0" usemap="#index_r1_c1Map"></td> <td rowspan="2" colspan="10"><img src="images/index_r1_c2.png" alt="" name="index_r1_c2" width="667" height="279" border="0" usemap="#index_r1_c2Map"></td> <td><img src="images/spacer.gif" width="1" height="164" border="0" alt=""></td> </tr> <tr> <td rowspan="21" valign="top" background="images/leftbackground3.gif"><!--DWLayoutEmptyCell--> </td> <td height="115"><img src="images/spacer.gif" width="1" height="115" border="0" alt=""></td> </tr> <tr> <td height="228" background="images/leftbackground.gif"><!--DWLayoutEmptyCell--> </td> <td colspan="4" valign="top"><form action="planilla.php" method="get" name="" id=""> <p>Nombre Completo<br> <input name="nombre1" type="text" id="nombre1" size="30"> </p> <p>Dirección de su Domicilio<br> <textarea name="direccion1" cols="30" id="direccion1"></textarea> </p> <p>Correo Electrónico<br> <input name="correo1" type="text" id="correo1" size="30"> </p> </form></td> <td colspan="3" valign="top"><form action="planilla.php" method="get" name="" id=""> <p>Cédula<br> <input name="cedula" type="text" id="cedula"> </p> <p> Número Telefónico<br> Casa <input name="casa" type="text" id="casa"> <br> Oficina <input name="oficina" type="text" id="oficina"> <br> Celular <input name="celular" type="text" id="celular"> </p> </form></td> <td colspan="2" valign="top" background="images/background.gif"><!--DWLayoutEmptyCell--> </td> <td><img src="images/spacer.gif" width="1" height="178" border="0" alt=""></td> </tr> <tr> <td height="43" colspan="10"><img name="index_r4_c2" src="images/index_r4_c2.png" width="667" height="43" border="0" alt=""></td> <td><img src="images/spacer.gif" width="1" height="43" border="0" alt=""></td> </tr> <tr> <td height="159" background="images/leftbackground.gif"><!--DWLayoutEmptyCell--> </td> <td colspan="3" valign="top"><form action="planilla.php" method="get" name="" id=""> <p>Nick o Seudónimo<br> <input name="nick" type="text" id="nick"> </p> <p>Correo Electrónico<br> <input name="corre2" type="text" id="corre2" size="30"> <br> Si es el mismo que el personal, <br> dejelo en blanco </p> </form></td> <td colspan="4" valign="top"><form action="planilla.php" method="get" name="" id=""> Productos ofertados<br> <textarea name="productos1" cols="30" rows="7" id="productos1"></textarea> <br> </form> </td> <td colspan="2" background="images/background.gif"><!--DWLayoutEmptyCell--> </td> <td><img src="images/spacer.gif" width="1" height="159" border="0" alt=""></td> </tr> <tr> <td height="39" colspan="10"><img name="index_r6_c2" src="images/index_r6_c2.png" width="667" height="39" border="0" alt=""></td> <td><img src="images/spacer.gif" width="1" height="39" border="0" alt=""></td> </tr> <tr> <td height="141" background="images/leftbackground.gif"><!--DWLayoutEmptyCell--> </td> <td colspan="5" valign="top"><form action="planilla.php" method="get" name="" id=""> <p>Nombre o Razón Social<br> <input name="nombre2" type="text" id="nombre2"> <br> Si es el mismo que el personal, <br> dejelo en blanco</p> <p>Método de Pago <select name="metodopago" id="metodopago"> <option selected>Mercado Pago</option> <option>Depósito Bancario</option> <option>Transferencia Bancaria</option> </select> </p> </form></td> <td colspan="2" valign="top"><form action="palnilla.php" method="get" name="" id=""> Número de cédula o RIF<br> <input name="cedularif" type="text" id="cedularif"> <br> Sólo si es Empresa o si desea que la factura salga a nombre de otra persona </form></td> <td colspan="2" background="images/background.gif"><!--DWLayoutEmptyCell--> </td> <td><img src="images/spacer.gif" width="1" height="131" border="0" alt=""></td> </tr> <tr> <td height="69" colspan="10"><img src="images/index_r8_c2.png" alt="" name="index_r8_c2" width="667" height="69" border="0" usemap="#index_r8_c2Map"></td> <td><img src="images/spacer.gif" width="1" height="69" border="0" alt=""></td> </tr> <tr> <td height="82" background="images/leftbackground.gif"><!--DWLayoutEmptyCell--> </td> <td colspan="7" valign="top"><form action="planilla.php" method="get" name="" id=""> <p>Fecha en que realizó la transacción <input name="fechamp" type="text" id="fechamp"> </p> <p>Monto cancelado <input name="montomp" type="text" id="montomp" value="Bs."> </p> </form></td> <td colspan="2" background="images/background.gif"><!--DWLayoutEmptyCell--> </td> <td><img src="images/spacer.gif" width="1" height="65" border="0" alt=""></td> </tr> <tr> <td height="103" colspan="10"><img name="index_r10_c2" src="images/index_r10_c2.png" width="667" height="103" border="0" alt=""></td> <td><img src="images/spacer.gif" width="1" height="103" border="0" alt=""></td> </tr> <tr> <td height="180" background="images/leftbackground.gif"><!--DWLayoutEmptyCell--> </td> <td colspan="7" valign="top"><p>Si selecciono como método de pago, "Depósito Bancario ó Transferecia" por favor indique:</p> <form action="planilla.php" method="get" name="" id=""> <p>Fecha en que realizó el depósito o transferencia <input name="fechadt" type="text" id="fechadt"> </p> <p>Monto cancelado o transferido <input name="montodt" type="text" id="montodt"> </p> <p>Número de depósito o transacción <input name="numdeptrans" type="text" id="numdeptrans"> </p> </form> <p> </p></td> <td colspan="2" background="images/background.gif"><!--DWLayoutEmptyCell--> </td> <td><img src="images/spacer.gif" width="1" height="130" border="0" alt=""></td> </tr> <tr> <td height="99" colspan="10"><img name="index_r12_c2" src="images/index_r12_c2.png" width="667" height="99" border="0" alt=""></td> <td><img src="images/spacer.gif" width="1" height="99" border="0" alt=""></td> </tr> <tr> <td height="134" background="images/leftbackground.gif"><!--DWLayoutEmptyCell--> </td> <td colspan="2"><img name="index_r13_c3" src="images/index_r13_c3.png" width="252" height="112" border="0" alt=""></td> <td colspan="5" valign="top"><form action="planilla.php" method="get" name="" id=""> <textarea name="productos2" cols="30" rows="7" id="productos2"></textarea> </form></td> <td colspan="2" background="images/background.gif"><!--DWLayoutEmptyCell--> </td> <td><img src="images/spacer.gif" width="1" height="112" border="0" alt=""></td> </tr> <tr> <td height="92" colspan="10"><img src="images/index_r14_c2.png" alt="" name="index_r14_c2" width="667" height="92" border="0" usemap="#index_r14_c2Map"></td> <td><img src="images/spacer.gif" width="1" height="92" border="0" alt=""></td> </tr> <tr> <td rowspan="3" background="images/leftbackground.gif"><!--DWLayoutEmptyCell--> </td> <td height="134" colspan="7"><form action="planilla.php" method="get" name="" id=""> <textarea name="direccion2" cols="30" rows="7" id="direccion2"></textarea> </form></td> <td rowspan="3" colspan="2" background="images/background.gif"><!--DWLayoutEmptyCell--> </td> <td><img src="images/spacer.gif" width="1" height="52" border="0" alt=""></td> </tr> <tr> <td height="34" colspan="7"><form action="planilla.php" method="get" name="" id=""> Compañía de envío solicitada <select name="compenvio" id="compenvio"> <option selected>MRW</option> <option>Zoom</option> <option>Tealca</option> <option>Ipostel</option> <option>Domesa</option> </select> </form></td> <td><img src="images/spacer.gif" width="1" height="34" border="0" alt=""></td> </tr> <tr> <td height="70" colspan="7"><img name="index_r17_c3" src="images/index_r17_c3.png" width="559" height="70" border="0" alt=""></td> <td><img src="images/spacer.gif" width="1" height="70" border="0" alt=""></td> </tr> <tr> <td height="40" colspan="10"><img name="index_r18_c2" src="images/index_r18_c2.png" width="667" height="40" border="0" alt=""></td> <td><img src="images/spacer.gif" width="1" height="40" border="0" alt=""></td> </tr> <tr> <td height="110" background="images/leftbackground2.gif"><!--DWLayoutEmptyCell--> </td> <td width="242" valign="top"><img src="images/index_r19_c3.png" width="242" height="110"></td> <td colspan="6" valign="top"><form action="planilla.php" method="get" name="" id=""> <textarea name="comentarios" cols="30" rows="7" id="comentarios"></textarea> </form></td> <td colspan="2" background="images/background.gif"><!--DWLayoutEmptyCell--> </td> <td><img src="images/spacer.gif" width="1" height="110" border="0" alt=""></td> </tr> <tr> <td height="12" colspan="10"><img name="index_r20_c2" src="images/index_r20_c2.png" width="667" height="12" border="0" alt=""></td> <td><img src="images/spacer.gif" width="1" height="12" border="0" alt=""></td> </tr> <tr> <td height="44" colspan="7"><img name="index_r21_c2" src="images/index_r21_c2.png" width="538" height="44" border="0" alt=""></td> <td colspan="2" background="images/index_r21_c8.png"><form action="planilla.php" method="get" name="" id=""> <input type="submit" name="Submit" value="Enviar"> </form></td> <td><img name="index_r21_c10" src="images/index_r21_c10.png" width="43" height="44" border="0" alt=""></td> <td><img src="images/spacer.gif" width="1" height="44" border="0" alt=""></td> </tr> <tr> <td rowspan="2" colspan="10"><img name="index_r22_c2" src="images/index_r22_c2.png" width="667" height="64" border="0" alt=""></td> <td height="10"><img src="images/spacer.gif" width="1" height="10" border="0" alt=""></td> </tr> <tr> <td height="54"><img name="index_r23_c1" src="images/index_r23_c1.png" width="133" height="54" border="0" alt=""></td> <td><img src="images/spacer.gif" width="1" height="54" border="0" alt=""></td> </tr> <tr> <td height="1"></td> <td></td> <td></td> <td width="10"></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> </table> </div> <map name="index_r8_c2Map"> <area shape="rect" coords="411,34,466,56" href="#"> </map> <map name="index_r14_c2Map"> <area shape="rect" coords="275,41,356,70" href="#"> </map> <map name="index_r1_c2Map"> <area shape="rect" coords="8,12,265,105" href="http://www.compushock.com"> </map> <map name="index_r1_c1Map"> <area shape="rect" coords="6,12,125,101" href="http://www.compushock.com"> </map> </body> </html> [/code] Codigo PhP [code]<? /* aqui se incializan variables de PHP */ if (phpversion() >= "4.2.0") { if ( ini_get('register_globals') != 1 ) { $supers = array('_REQUEST', '_ENV', '_SERVER', '_POST', '_GET', '_COOKIE', '_SESSION', '_FILES', '_GLOBALS' ); foreach( $supers as $__s) { if ( (isset($$__s) == true) && (is_array( $$__s ) == true) ) extract( $$__s, EXTR_OVERWRITE ); } unset($supers); } } else { if ( ini_get('register_globals') != 1 ) { $supers = array('HTTP_POST_VARS', 'HTTP_GET_VARS', 'HTTP_COOKIE_VARS', 'GLOBALS', 'HTTP_SESSION_VARS', 'HTTP_SERVER_VARS', 'HTTP_ENV_VARS' ); foreach( $supers as $__s) { if ( (isset($$__s) == true) && (is_array( $$__s ) == true) ) extract( $$__s, EXTR_OVERWRITE ); } unset($supers); } } /* DE AQUI EN ADELANTE PUEDES EDITAR EL ARCHIVO */ /* aquí se especifica la pagina de respuesta en caso de envío exitoso */ $respuesta="respuesta.htm"; // la respuesta puede ser otro archivo, en incluso estar en otro servidor /* AQUÍ ESPECIFICAS EL CORREO AL CUAL QUEIRES QUE SE ENVÍEN LOS DATOS DEL FORMULARIO, SI QUIERES ENVIAR LOS DATOS A MÁS DE UN CORREO, LOS PUEDES SEPARAR POR COMAS */ $para ="formulario@compushock.com"; /* AQUI ESPECIFICAS EL SUJETO (Asunto) DEL EMAIL */ $sujeto = "Envio de Formulario"; /* aquí se construye el encabezado del correo, en futuras versiones del script explicaré mejor esta parte */ $encabezado = "From: $nombre1 <$email>"; $encabezado .= "\nReply-To: $email"; $encabezado .= "\nX-Mailer: PHP/" . phpversion(); /* con esto se captura la IP del que envío el mensaje */ $ip=$REMOTE_ADDR; /* las siguientes líneas arman el mensaje */ $mensaje .= "Nombre Completo: $nombre1\n"; $mensaje .= "Cedula: $cedula\n"; $mensaje .= "Direccion de Domicilio: $direccion1\n"; $mensaje .= "Numero Telefonico: $xxx\n"; $mensaje .= "Casa: $casa\n"; $mensaje .= "Oficina: $oficina\n"; $mensaje .= "Celular: $celular\n"; $mensaje .= "Correo Electronico: $correo1\n"; $mensaje .= "Nick o Seudonimo: $nick\n"; $mensaje .= "Correo Electronico: $correo2\n"; $mensaje .= "Productos Ofertados: $productos1\n"; $mensaje .= "Nombre o Razón Social: $nombre2\n"; $mensaje .= "Cédula o RIF de Facturación: $cedularif\n"; $mensaje .= "Metodo de Pago: $metodopago\n"; $mensaje .= "MercadoPago: $xxx\n"; $mensaje .= "Fecha en que realizo la Transaccion: $fechamp\n"; $mensaje .= "Monto Depositado: $montomp\n"; $mensaje .= "Deposito o Transferencia: $xxx\n"; $mensaje .= "Fecha en que realizo el Deposito o la Transferencia: $fechadt\n"; $mensaje .= "Monto Depositado: $montodt\n"; $mensaje .= "Numero de Deposito o Transferencia: $numdeptrans\n"; $mensaje .= "Productos Adquiridos: $productos2\n"; $mensaje .= "Direccion de Envio: $direccion2\n"; $mensaje .= "Compañia de Envio Solicitada: $compenvio\n"; $mensaje .= "Comentarios y Sugerencias: $comentarios\n"; $mensaje .= "Dirección IP del Comprador: $ip\n"; /* aqui se intenta enviar el correo, si no se tiene éxito se da un mensaje de error */ if(!mail($para, $sujeto, $mensaje, $encabezado)) { echo "<h1>No se pudo enviar el Mensaje</h1>"; exit(); } else { /* aqui redireccionamos a la pagina de respuesta */ echo "<meta HTTP-EQUIV='refresh' content='1;url=$respuesta'>"; } ?>[/code] Gracias a quien pueda ayudarme |
|