Tengo un par de php que envian un html como recomendación de un sitio, todo funciona bien, el html se va y llega sin problema..... el de talle es que llega como remitente desconocido, por lo cual deseo agergar este campo en el formulario como "tu nombre" y que este sea el que apareca en el mail del recomendado..... ojala me pudieran ayudar dejo los php. saludos y gracias
Este es el formulario donde hay que agregar el campo "tu nombre":
Código :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>... envio ...</title> <script type="text/javascript"> function FVal(form){ var msjerror; msjerror=""; if (!(/^[a-z0-9._%-]+@[a-z0-9.-]+\.[a-z]{2,4}$/.test(form.destinatario.value))) msjerror+="- El correo electronico del destinatario no es un email valido\n"; if (!(/^[a-z0-9._%-]+@[a-z0-9.-]+\.[a-z]{2,4}$/.test(form.remitente.value))) msjerror+="- El correo electronico del remitente no es un email valido\n"; if (form.asunto.value=="" || FC_JS_cadenaIncorrecta(form.asunto.value,"0") || FC_JS_cadenaIncorrecta(form.asunto.value," ") ) //con vacios msjerror+="- El Asunto esta vacio\n"; if (form.mensaje.value=="" || FC_JS_cadenaIncorrecta(form.mensaje.value,"0") || FC_JS_cadenaIncorrecta(form.mensaje.value," ") ) //con vacios msjerror+="- El Mensaje esta vacio\n"; if(msjerror!=""){ alert('No podemos enviar tu mensaje ya que faltan datos:\n'+msjerror); } else{ form.submit(); } } // revisa que el elemento no tenga solamente algún caracter considerado como no válido (espacio en blanco, ceros, etc) function FC_JS_cadenaIncorrecta(cad, car) { var cadena = cad; for (j=0; cad.length > j && cadena.charAt(j) == car; j++); if (cad.length != j) return 0; else return 1; } </script> <style type="text/css"> <!-- body { background-color: #FFFFFF; } --> </style></head> <body bottommargin="0" leftmargin="0" topmargin="0" rightmargin="0"> <table width="450" height="500" border="0" align="center" cellpadding="0" cellspacing="0" background="images/backG.jpg"> <tr bgcolor="#FFFFFF"> <td width="450" height="50" align="center" valign="middle"> </td> </tr> <tr> <td width="450" height="400" align="center" valign="middle" bgcolor="#FFFFFF"> <form id="form1" name="form1" method="post" action="email.php"> <p><a href="http://www.luci.com.mx"><img name="mailingluci_r3_c1" src="http://www.egocentra.com/luci/mailingluci_r3_c1.jpg" width="612" height="402" border="0" id="mailingluci_r3_c1" alt="" /></a></p> <table width="400" border="0" cellspacing="0" cellpadding="0"> <tr> <td><span style="font-family:Arial, Helvetica, sans-serif; font-size:10px">* E-Mail de su amiga:<br /> <input name="destinatario" type="text" size="30" /> </span> <br /> <span style="font-family:Arial, Helvetica, sans-serif; font-size:10px">* Su E-mail:<br /> <input name="remitente" type="text" size="30" /> </span><span style="font-family:Arial, Helvetica, sans-serif; font-size:10px"><br /> * Asunto:<br /> <input name="asunto" type="text" size="30" /> </span> <br /> <span style="font-family:Arial, Helvetica, sans-serif; font-size:10px">* Mensaje:<br /> <textarea name="mensaje" cols="40" rows="7" style="font-family:Arial, Helvetica, sans-serif; font-size:10px;" onclick="javascript:this.value='';">Escriba su mensaje aquí.</textarea> </span> <br /> <br /> <input name="Botón" type="button" value="Reenvíelo a una Amiga" onclick="javascript:FVal(this.form)" /></td> </tr> </table> </form> </td> </tr> <tr> <td width="450" height="50" align="center" valign="middle" bgcolor="#000000"><img name="mailingluci_r2_c1" src="http://www.egocentra.com/luci/mailingluci_r2_c1.jpg" width="612" height="84" border="0" id="mailingluci_r2_c1" alt="" /></td> </tr> </table> </body> </html>
y este es el mail que llega al amigo
Código :
<HTML><title>"Reenvio"</title> <style type="text/css"> <!-- .style1 { font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold; } .style3 {font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold; color: #FFFFFF; } .style4 {color: #5AA3A5} .style6 {font-size: 12px; color: #D8D8D8; font-family: Geneva, Arial, Helvetica, sans-serif;} --> </style> <div align="center"> <?php $codigohtml = file_get_contents('index.html'); $codigohtml.="<br><br><strong>Mensaje de: ".$_REQUEST['remitente']."<br>Para: ".$_REQUEST['destinatario']."<br>Mensaje adicional enviado:</strong><br>".$_REQUEST['mensaje']; $cabeceras = "Content-type: text/html\r\nFrom:".$_REQUEST['remitente']; $asunto=$_REQUEST['asunto']; $email=$_REQUEST['destinatario']; mail($email,$asunto,$codigohtml,$cabeceras); echo "E-mail enviado a ".$_REQUEST['destinatario']; ?> </div> <div align="center"> <table width="612" border="0" align="center" cellpadding="0" cellspacing="0"> <!-- fwtable fwsrc="Sin título" fwbase="mailingluci.jpg" fwstyle="Dreamweaver" fwdocid = "1599551988" fwnested="0" --> <tr> <td><img src="http://www.egocentra.com/luci/spacer.gif" width="181" height="1" border="0" alt="a" /></td> <td><img src="http://www.egocentra.com/luci/spacer.gif" width="273" height="1" border="0" alt="a" /></td> <td><img src="http://www.egocentra.com/luci/spacer.gif" width="19" height="1" border="0" alt="a" /></td> <td><img src="http://www.egocentra.com/luci/spacer.gif" width="139" height="1" border="0" alt="a" /></td> <td><img src="spacer.gif" width="1" height="1" border="0" alt="a" /></td> </tr> <tr> <td colspan="3"> </td> <td bgcolor="#6BB5B6"><div align="center" class="style3"><a href="http://www.egocentra.com/luci/enviar.php" class="style3">Envíe a una amiga </a></div></td> <td><img src="http://www.egocentra.com/luci/spacer.gif" width="1" height="31" border="0" alt="a" /></td> </tr> <tr> <td colspan="4"><a href="http://www.luci.com.mx"><img name="mailingluci_r2_c1" src="http://www.egocentra.com/luci/mailingluci_r2_c1.jpg" width="612" height="84" border="0" id="mailingluci_r2_c1" alt="aa" /></a></td> <td><img src="http://www.egocentra.com/luci/spacer.gif" width="1" height="84" border="0" alt="aa" /></td> </tr> <tr> <td rowspan="2" colspan="4"><a href="http://www.luci.com.mx"><img name="mailingluci_r3_c1" src="http://www.egocentra.com/luci/mailingluci_r3_c1.jpg" width="612" height="402" border="0" id="mailingluci_r3_c1" alt="a" /></a></td> <td><img src="http://www.egocentra.com/luci/spacer.gif" width="1" height="18" border="0" alt="a" /></td> </tr> <tr> <td><img src="spacer.gif" width="1" height="384" border="0" alt="a" /></td> </tr> <tr> <td colspan="4"><a href="http://www.luci.com.mx"><img name="mailingluci_r5_c1" src="http://www.egocentra.com/luci/mailingluci_r5_c1.jpg" width="612" height="213" border="0" id="mailingluci_r5_c1" alt="a" /></a></td> <td><img src="http://www.egocentra.com/luci/spacer.gif" width="1" height="213" border="0" alt="a" /></td> </tr> <tr> <td colspan="4"><a href="http://www.luci.com.mx"><img name="mailingluci_r6_c1" src="http://www.egocentra.com/luci/mailingluci_r6_c1.jpg" width="612" height="208" border="0" id="mailingluci_r6_c1" alt="a" /></a></td> <td><img src="http://www.egocentra.com/luci/spacer.gif" width="1" height="208" border="0" alt="a" /></td> </tr> <tr> <td colspan="4"><a href="http://www.lancome.com.mx"><img name="mailingluci_r7_c1" src="http://www.egocentra.com/luci/mailingluci_r7_c1.jpg" width="612" height="35" border="0" id="mailingluci_r7_c1" alt="a" /></a></td> <td><img src="http://www.egocentra.com/luci/spacer.gif" width="1" height="35" border="0" alt="a" /></td> </tr> <tr> <td colspan="4"><a href="http://laeuropea.com.mx/fauchon/intro.html "><img name="mailingluci_r8_c1" src="http://www.egocentra.com/luci/mailingluci_r8_c1.jpg" width="612" height="32" border="0" id="mailingluci_r8_c1" alt="a" /></a></td> <td><img src="http://www.egocentra.com/luci/spacer.gif" width="1" height="32" border="0" alt="a" /></td> </tr> <tr> <td colspan="4" bgcolor="#000000"><p align="center" class="style6">Al presentar este e-mail en cualquiera de las tiendas de la Europea del Distrito Federal<br /> y área metropolitana, reciba de parte de FAUCHON una caja con Mini Crepas de 20g.*<br /> * Hasta agotar existencias, no aplica con otras promociones * Limitado a 100 piezas</p></td> <td><img src="http://www.egocentra.com/luci/spacer.gif" width="1" height="45" border="0" alt="a" /></td> </tr> <tr> <td bgcolor="#000000"> </td> <td bgcolor="#000000"><div align="center"><span class="style6">*Promoción válida hasta el 30 de Abril de 2008</span></div></td> <td colspan="2"><a href="http://laeuropea.com.mx/fauchon/intro.html "><img name="mailingluci_r10_c3" src="http://www.egocentra.com/luci/mailingluci_r10_c3.jpg" width="158" height="31" border="0" id="mailingluci_r10_c3" alt="a" /></a></td> <td><img src="http://www.egocentra.com/luci/spacer.gif" width="1" height="31" border="0" alt="a" /></td> </tr> </table> <p align="center" class="style1">Si no desea recibir más información de Lancome haga <span class="style4"><a href="http://www.egocentra.com/luci/baja.html">clic aqui</a></span></p> <p align="center" class="style1"></p> </div> </HTML>
=)