[#] hm X_Shell Backd00r [#]
<?php
require_once '../../../buen-fin/app/library/mail/class.phpmailer.php';
$data = json_decode( file_get_contents("php://input") );
require_once "../model/SaveTest.model.php";
$objTest = new Tests();
$key = '';
$longitud = 12;
$pattern = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$max = strlen($pattern)-1;
for($i=0;$i < $longitud;$i++) $key .= $pattern{mt_rand(0,$max)};
if(!$objTest->validarMail($data->email)){
if( $objTest->insertTest( $data->nombre, $data->email, $key, json_encode($data->respuetas) ) ){
$from = "Autodromo Intl. Miguel E. Abed";
$body = '<html>
<head>
<title>Autodromo</title>
<meta http-equiv=\"\" content=\"text/html; charset=iso-8859-1\">
</head>
<body style="font-family:Arial, Helvetica, sans-serif; max-width: 970px;">
<img src="http://www.autodromomabed.com/encuesta/img/banner-aut-her.jpg" alt="Track Day For Hear">
<p style="text-align:center;font-size:">Estimada <strong>'.$data->nombre.'</strong><br> Muchas gracias por su registro.</p>
<p style="text-align:center;font-size:35px;font-weigth:bold;">Su código de registro es:</p>
<div style="text-align:center;padding: 27px 29px; color:#fff; background-color: #fc5597;font-size: 25px;">'.$key.'</div>
<p style="text-align:center;font-size:30px;font-weigth:bold;"><strong>'.utf8_decode('¡Tu opinión es importante para nosotros!').'</strong></p>
<p>Por favor presenta este código con personal del Autódromo en el próximo #TrackDayForHer y recibe un obsequio. Mantente pendiente de nuestras promociones y sorpresas que tendremos para ti</p>
</body>
</html>';
$mail = new PHPMailer(true);
$mail->IsSMTP();
try {
$mail->SMTPAuth=true;
$mail->SMTPSecure = 'ssl';
$mail->Host="smtp.zoho.com";
$mail->Port=465;
$mail->Username="contactowinpeed2@racingface.com";
$mail->Password="didczrlhpyjx";
$mail->SMTPDebug=1;
$mail->Helo = "winpeed.abdsystems.com"; //Muy importante para que llegue a hotmail y otros
$mail->AddAddress($data->email);
$mail->IsHTML(true);
$mail->Subject="Autodromo Intl. Miguel E. Abed";
$mail->From="contactowinpeed2@racingface.com";
$mail->FromName= $from;
$mail->Timeout=30;
$mail->Body= $body;
$mail->AltBody = strip_tags($body);
if($mail->Send()){
$msg = array('success','Ha recibido un mensaje en el correo que ingreso.');
}else{
$msg = array('error','Error al enviar mensaje');
}
} catch (phpmailerException $e){
$msg = $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
$msg = $e->getMessage(); //Boring error messages from anything else!
}
//$msg = $key;
}else{
$msg = array('error','Error: Intente más tarde.');
}
}else{
$msg = array('error','El correo que ingreso ya está registrado.');
}
echo json_encode($msg);
?>
Mr.hm X_Shell Backd00r 1.0, Coded By Mr.hm X_Shell Backd00r