Código:
<form action="recomendar/recomendar.php" method="post"> <input type="hidden" name="url" value="<? echo $_SERVER['HTTP_REFERER']; ?>"> <center> <span class="style1">Recomenda Esto a un amigo</span> </center> <table width="100%" border="1" bgcolor="#484848"> <tr> <td width="50%"> <div align="center">Tus Datos:</div></td> <td width="50%"><div align="center">Datos De tu Amigo:<br> </div></td> </tr> <tr> <td><div align="center">Tu Nombre: <input type="text" name="tunombre"> </div></td> <td> <div align="center">Su Nombre: <input type="text" name="sunombre"> </div></td> </tr> <tr> <td><div align="center"> Tu Email: <input type="text" name="tuemail"> </div></td> <td><div align="center"> Su Email: <input type="text" name="suemail"> </div></td> </tr> <tr> <td><div align="center"> </div></td> <td><div align="center"> <input type="submit" name="enviar" value=" Enviar "> </div></td> </tr> </table>
recomendar.php
Código PHP:
<?php
if (isset($_POST['url']) && isset($_POST['enviar'])){
$url_recomendado= $_SERVER['HTTP_REFERER'];
$redireccion=$_SERVER['HTTP_REFERER'];
//para el envío en formato HTML
// Para enviar correo HTML, la cabecera Content-type debe definirse
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
//dirección del remitente
$headers .= 'From: Recomendados Radiometal <[email protected]>' . "\r\n";
//dirección de respuesta, si queremos que sea distinta que la del remitente
$headers .= "Reply-To: [email protected]\r\n";
//el que envia
$tuemail = $_POST['tuemail'];
$tunombre = $_POST['tunombre'];
// el que recibe
$sunombre = $_POST['sunombre'];
$suemail = $_POST['suemail'];
$asunto = "Hola, " .$sunombre. " Tu amigo, ".$tunombre." Te Recomendo Esto..." ;
$mensaje= "Hola, " .$sunombre. "\r\n Tu amigo " .$tunombre."\r\n Te recomendo visitar el siguiente enlace \r\n\r\n Click En El Enlace Para ingresar\r\n" .$url_recomendado."\r\n" ;
mail($suemail,$asunto,$mensaje,"MIME-Version: 1.0 \r\n Content-type: text/html; charset=iso-8859-1 \r\n From: [email protected]\r\nContent-type: text/html\r\n");
header("Location: $redireccion");
}
//
?>
Po rejemplo si uso
Código PHP:
mail($suemail,$asunto,$mensaje,"MIME-Version: 1.0 \r\n Content-type: text/html; charset=iso-8859-1 \r\n From: [email protected]\r\nContent-type: text/html\r\n");
M ellega el correo en formato html y sel link se ve barbaro con los saltos de line ay todo. Pero el correo sale con el nomrbe del servidor y no con [email protected] como deberia llegar.
Opcion 2 usar los $headers qu eestan ahi
Código PHP:
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
//dirección del remitente
$headers .= 'From: Recomendados miweb<[email protected]>' . "\r\n";
//dirección de respuesta, si queremos que sea distinta que la del remitente
$headers .= "Reply-To: [email protected]\r\n";
Ose al funcoin mail quedarisa asi.
Código PHP:
mail($suemail,$asunto,$mensaje,$headers)
Alguna ayuda?
Debe ser algo fasil pero h eintentado con distintos headers y distintas formas y weno hast aahor aconsegui eso y no se por que.
Salu2
![Adios](http://static.forosdelweb.com/fdwtheme/images/smilies/adios.gif)