functions.js
Código Javascript:
Ver original
$(document).ready(function(){ $('#sendMail').click(function(){ var cat = $('#categoria').val(); var nom = $('#nombre').val(); var mail = $('#email').val(); if($('#tos').is(':checked')){ $.ajax({ type: 'GET', url: 'sendMail.php', data: { categoria: cat, nombre: nom, email: mail }, success: function(response){ alert(response); } }); }else{ alert('Acepta los terminos y condiciones'); } }); });
sendMail.php
Código PHP:
Ver original
<?php } require_once('class.phpmailer.php'); //include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded $uid=$_SESSION['uid']; $name="Enviado por: ".$nombre; $mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch $body[]= '[category PHP] [status pending] <img src="http://algo.com/imagen/'.$uid.'.png" ><br /><br />'.$name.' '; $body[]='[category chist] [status pending] <img src="http://tusitio.com/chistes/imagen/'.$uid.'.png" ><br /><br />'.$name.' '; $mail->IsSMTP(); // telling the class to use SMTP try { $mail->CharSet = "UTF-8"; $mail->Host = "mx1.hostinger.es"; // SMTP server $mail->SMTPAuth = true; // enable SMTP authentication $mail->Host = "mx1.hostinger.es"; // sets the SMTP server $mail->Port = 2525; // set the SMTP port for the smtp server $mail->Username = "kjhkjh"; // SMTP account username $mail->Password = "jgdjkh"; for($i=0;$i<2;$i++){ $mail->AddAddress($email[$i]); $mail->SetFrom($from , $nombre); $mail->MsgHTML($body[$i]); $mail->Send(); } echo "Chiste enviado"; } catch (phpmailerException $e) { echo $e->errorMessage(); //Pretty error messages from PHPMailer } catch (Exception $e) { echo $e->getMessage(); //Boring error messages from anything else! }
y este es el HTML donde recibo los datos
Código HTML:
y no se que pasa Ver original
<!DOCTYPE html> <html lang="es"> <head> <meta charset="utf-8"> <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"> <style> body{ padding:15px; } a{ text-decoration:none; } </style> </head> <body> <div> <center> <div> <img src="imagen/53505644b66a5.png" /> </div> </center> <br /> <center> <div> <a href="https://www.facebook.com/sharer/sharer.php?u=http://app.xskarx.com/beta2/showImage.php?img=53505644b66a5" target="_blank"> <img src="src/fbshare.png" /> <img src="src/twittershare.png" /> </a> <div> <!-- Modal --> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> </div> <div class="modal-body"> <select id="categoria" name="categoria" class="form-control"> </div> <div class="modal-footer"> </div> </div> </div> </div> </center> </div> </body> </html>