Hola buena stardes tengo un rpoblema con este codigo, intento enviar el correo utilizando javascript y la libreria de PHPMailer y todo bien desde el javascript, el php recibe los datos, lo se por que realice la prueba de imprimirloas en el documento y funciona pero el rpoblema es al enviar el correo, oajala alguien me pueda ayudar a echarle un ojo al codigo, que segun yo deberia funcionar ya que lo tengo en otro pagina corriendo bien, bueno muchas gracias,
Código PHP:
<?php
if ((isset($_POST['name'])) && (strlen(trim($_POST['name'])) > 0)) {
$name = stripslashes(strip_tags($_POST['name']));
} else {$name = 'No ingreso nombre';}
if ((isset($_POST['contact_email'])) && (strlen(trim($_POST['contact_email'])) > 0)) {
$contact_email= stripslashes(strip_tags($_POST['contact_email']));
} else {$contact_email= 'No ingreso email';}
if ((isset($_POST['phone'])) && (strlen(trim($_POST['phone'])) > 0)) {
$phone = stripslashes(strip_tags($_POST['phone']));
} else {$phone = 'No ingreso numero telefonico';}
if ((isset($_POST['tag'])) && (strlen(trim($_POST['tag'])) > 0)) {
$tag = stripslashes(strip_tags($_POST['tag']));
} else {$tag = 'No ingreso numero de TAG';}
ob_start();
?>
<html>
<head>
<style type="text/css">
</style>
</head>
<body>
<table width="550" border="1" cellspacing="2" cellpadding="2">
<tr bgcolor="#eeffee">
<td>Nombre</td>
<td><?=utf8_decode($name);?></td>
</tr>
<tr bgcolor="#eeeeff">
<td>Email</td>
<td><?=$contact_email;?></td>
</tr>
<tr bgcolor="#eeffee">
<td>Teléfono</td>
<td><?=$phone;?></td>
</tr>
<tr bgcolor="#eeeeff">
<td>TAG</td>
<td><?=$tag;?></td>
</tr>
</table>
</body>
</html>
<?
$body = ob_get_contents();
$to = '';
$email = '';
$fromaddress = "";
$fromname = "";
require("phpmailer.php");
$mail = new PHPMailer();
$mail->From = $contact_email;
$mail->FromName = utf8_decode($name);
$mail->AddAddress("***@***.com.mx","Destinatario 1");
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = "Registro de TAG";
$mail->Body = $body;
$mail->AltBody = "Solo texto";
if(!$mail->Send()) {
$recipient = '***@***.com.mx';
$subject = 'Error';
$content = $body;
mail($recipient, $subject, $content, "Reply-To: $email\r\nX-Mailer: DT_formmail");
exit;
}
?>