El envía el email, el problema esta que envía todo el codigo de la pagina html y no solo los datos que requiero y la foto tampoco la envia alquien me puede ayudar tengo el siguiente codigo....
Código PHP:
<?php session_start(); ?>
<style type="text/css">
#formulariodecontacto{
font-family:"Times New Roman", Times, serif;
font-size:12px;
font-weight:normal;
color: #333;
}
#formulariodecontacto input {
font-size:12px;
color:#333;
}
</style>
<div id="formulariodecontacto">
<form action="" method="post">
<table>
<tr>
<td width="300">
<img width="300" src="http://www.iephe.com/enviarAmigo/card_gana_un_premio_1.jpg" /><br/>
<input type="radio" name="imagen" value="1" />
</td>
<td width="296">
<img width="300" src="http://www.iephe.com/enviarAmigo/card_gana_un_premio_2.jpg" /><br/>
<input type="radio" name="imagen" value="2" />
</td>
</tr>
</table>
<table width="600" border="0" cellspacing="0" cellpadding="2" style="font-family:'Times New Roman', Times, serif; font-size:14px; color: #333;">
<tr>
<td>Tu Nombre</td>
<td><input name="nombres" type="text" maxlength="35" size="50" value="<?php if(isset($_POST["nombres"])) {echo $_POST["nombres"];} ?>">*</td>
</tr>
<tr>
<td>Tu E-mail</td>
<td><input name="email" type="text" maxlength="50" size="50" value="<?php if(isset($_POST["email"])) {echo $_POST["email"];} ?>">*</td>
</tr>
<tr>
<td>Tu Dirección</td>
<td><input name="direccion" type="text" maxlength="35" size="50" value="<?php if(isset($_POST["direccion"])) {echo $_POST["telefono"];} ?>"></td>
</tr>
<tr>
<td valign="top">Mensaje</td>
<td><textarea name="mensaje" cols="48" rows="10" maxlength="500">
Hola, acabo de recibir un servicio gratuito de purificacion de aire y descontaminación en mi hogar, además me indicaron como prevenir enfermedades graves, ¡fue realmente impresionante! Me otorgaron el derecho de obsequiar 4 de estos servicios a las familias que más aprecio y los escogí a ustedes. Por favor recibe la llamada en estos días para hacer una cita y me ayudas porque ganaré un obsequio si los recibes.
Saludos Cordiales.</textarea>
*</td>
</tr>
<tr>
<td>Nombres de tu Amigo</td>
<td><input name="nombres2" type="text" maxlength="35" size="50" value="<?php if(isset($_POST["nombres2"])) {echo $_POST["nombres2"];} ?>">*</td>
</tr>
<tr>
<td>E-mail de tu Amigo</td>
<td><input name="email2" type="text" maxlength="50" size="50" value="<?php if(isset($_POST["email2"])) {echo $_POST["email2"];} ?>">*</td>
</tr>
<tr>
<td> </td>
<td><img id="captcha" src="./securimage/securimage_show.php" alt="CAPTCHA Image" /><a href="#" onclick="document.getElementById('captcha').src = './securimage/securimage_show.php?' + Math.random(); return false"><img src="./securimage/images/refresh.gif" alt="Recargar" border="0"/></a></td>
</tr>
<tr>
<td> </td>
<td> <input type="text" name="captcha_code" size="27" maxlength="6" /> *</td>
</tr>
<tr>
<td><input name="action" type="hidden" value="send"></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><input name="enviar" type="submit" value="Enviar"></td>
</tr>
</table>
</form>
</div>
<?php
if (isset($_POST['action'])) {
//Mail del amigo
$dest = $_POST['email2'];
//Encabezado mail - Nombre y mail del remitente
$head = "From: ".$_POST['nombres']."<".$_POST['email'].">\r\n";
$head .= "Content-type: text/html\r\n";
$asunto = $_POST['nombres']." te recomienda Sistemas Rainbow";
$email = $_POST['email'];
$template = '<!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=UTF-8" />
<title>Iephe</title>
</head>
<body bgcolor="#666666">
<font color="#FFF">
<table width="600" border="0" align="center" bgcolor="#000">
<tr>
<td><img src="http://www.iephe.com/enviarAmigo/'.$_POST['imagen'].'.jpg" /></td>
</tr>
</table><br/>
<table width="600" border="0" align="center" bgcolor="#000">
<tr>
<td>
<h2>Tu amigo pensó que podría interesarte saber sobre el Sistema Rainbow.</h2>
<p>Si quieres saber más sobre Rainbow, haz clic <a href="http://www.iephe.com/" target="_blank">aquí</a> o copia y pega la siguiente dirección web en tu explorador.<br/>
<a href="http://www.iephe.com/" target="_blank">http://www.iephe.com/</a></p>
</td>
</tr>
<tr>
<td>
Los datos de tu amigo son:<br/>
<table>
<tr>
<td><b>Nombre:</b> </td>
<td>'.htmlentities($_POST['nombres']).'</td>
</tr>
<tr>
<td><b>E-mail:</b></td>
<td>'.htmlentities($_POST['email']).'</td>
</tr>
<tr>
<td><b>Dirección:</b></td>
<td>'.htmlentities($_POST['direccion']).'</td>
</tr>
<tr>
<td><b>Mensaje:</b></td>
<td>'.htmlentities($_POST['mensaje']).'</td>
</tr>
</table>
</td>
</tr>
</table>
</font>
</body>
</html>';
// CAMPOS REQUERIDOS
if(empty($_POST['nombres'])) die("El campo Nombre Completo es requerido");
if(empty($_POST['email'])) die("El campo E-mail es requerido");
if(empty($_POST['mensaje'])) die("El campo Mensaje es requerido");
if(empty($_POST['imagen'])) die("El campo Imagen es requerido");
// VALIDAR EMAIL
function validarCorreo($email)
{
return eregi('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@([a-z0-9]+[\.-])*[a-z0-9]+\.[a-z]{2,6}$',$email);
}
if(validarCorreo($email)) { }
else { die ('Su E-mail no es valido, verifiquelo e intentelo nuevamente.'); }
// CAPTCHA
include_once $_SERVER['DOCUMENT_ROOT'] . '/securimage/securimage.php';
$securimage = new Securimage();
if ($securimage->check($_POST['captcha_code']) == false) {
die('El codigo es incorrecto, intentelo nuevamente.');
}
// ENVIO DEL MENSAJE
if (mail($dest, $asunto, $template, $head)) {
echo "Su mensaje fue enviado, pronto estaremos en contacto. Gracias.";
} else {
echo "Error de envio, intentelo nuevamente.";
}
}
?>