| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317 |
- <?php
- if (isset($_POST['nombreBolsa'])) {
- $nombreBolsa = $_POST['nombreBolsa'];
- $apellidosBolsa = $_POST['apellidosBolsa'];
- $correoBolsa = $_POST['correoBolsa'];
- $numeroBolsa = $_POST['numeroBolsa'];
- $codigoPostal = $_POST['codigoPostal'];
- $ciudadBolsa = $_POST['ciudadBolsa'];
- $pais = $_POST['pais'];
- $comentariosBolsa = $_POST['comentariosBolsa'];
- //variables para los datos del archivo
- $nameFile = $_FILES['curriculum']['name'];
- $sizeFile = $_FILES['curriculum']['size'];
- $typeFile = $_FILES['curriculum']['type'];
- $tempFile = $_FILES["curriculum"]["tmp_name"];
- //Archivo 2
- $nameFile2 = $_FILES['carta']['name'];
- $sizeFile2 = $_FILES['carta']['size'];
- $typeFile2 = $_FILES['carta']['type'];
- $tempFile2 = $_FILES["carta"]["tmp_name"];
-
- $recaptcha_url = 'https://www.google.com/recaptcha/api/siteverify';
- $recaptcha_secret = '6LcCmZ8UAAAAAE1Jzojch6baCHm_7UWGxVZMkgiL';
- $recaptchaGet = file_get_contents($recaptcha_url . '?secret=' . $recaptcha_secret . '&response=' . $recaptcha_response);
- $recaptcha = json_decode($recaptchaGet,true);
- // Miramos si se considera humano o robot:
- // echo json_encode($recaptcha);
- /*if ($recaptcha['success'] == true) {
- if($recaptcha['score'] >= 0.1){*/
-
- //enviamos el correo
- enviarCorreo($nombreBolsa,$apellidosBolsa,$correoBolsa,$numeroBolsa,$codigoPostal,$ciudadBolsa,$pais,$comentariosBolsa,
- $nameFile,$sizeFile,$typeFile,$tempFile,$nameFile2,$sizeFile2,$typeFile2,$tempFile2);
- /* }else{
- controlError(false,"No hemos podido descubrir que eres un humano, por favor recarga la Página");
- }
- }else{
- controlError(false,"Captcha repetido o invalido, favor de recargar la Página.");
- }*/
- }
- function enviarCorreo($nombreBolsa,$apellidosBolsa,$correoBolsa,$numeroBolsa,$codigoPostal,$ciudadBolsa,$pais,$comentariosBolsa,
- $nameFile,$sizeFile,$typeFile,$tempFile,$nameFile2,$sizeFile2,$typeFile2,$tempFile2){
- //Se crea una clave única para identificar que es un mismo correo
- $uniqueid= uniqid('np');
-
- $to = "marketing@rake.mx";
- $subject = "CONTACTO WEB";
- $cabeceras = 'MIME-Version: 1.0' . "\r\n";
- //El correo contendrá diferente contenido
- $cabeceras .= "Content-Type: multipart/mixed;boundary=" . $uniqueid. "\r\n";
- $cabeceras .= 'From: Rake MX<web@rake.mx>' . "\r\n";
- $body .= "\r\n\r\n--" . $uniqueid. "\r\n";
- $body .= "Content-type: text/html;charset=utf-8\r\n\r\n";
- $body .= "<!DOCTYPE html>
- <html>
-
- <head>
- <meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
- <meta content='width=device-width, initial-scale=1' name='viewport'>
-
- <title>You're invited!</title>
- <!-- Designed by https://github.com/kaytcat -->
- <!-- Robot header image designed by Freepik.com -->
-
- <style type='text/css'>
- @import url(http://fonts.googleapis.com/css?family=Droid+Sans);
- /* Take care of image borders and formatting */
-
- img {
- max-width: 600px;
- outline: none;
- text-decoration: none;
- -ms-interpolation-mode: bicubic;
- }
-
- a {
- text-decoration: none;
- border: 0;
- outline: none;
- color: #bbbbbb;
- }
-
- a img {
- border: none;
- }
- /* General styling */
-
- td,
- h1,
- h2,
- h3 {
- font-family: Helvetica, Arial, sans-serif;
- font-weight: 400;
- }
-
- td {
- text-align: center;
- }
-
- body {
- -webkit-font-smoothing: antialiased;
- -webkit-text-size-adjust: none;
- width: 100%;
- height: 100%;
- color: #37302d;
- background: #ffffff;
- font-size: 16px;
- }
-
- table {
- border-collapse: collapse !important;
- }
-
- .headline {
- color: #ffffff;
- font-size: 36px;
- }
-
- .force-full-width {
- width: 100% !important;
- }
-
- .force-width-80 {
- width: 80% !important;
- }
- </style>
- <style media='screen' type='text/css'>
- @media screen {
- /*Thanks Outlook 2013! */
- td,
- h1,
- h2,
- h3 {
- font-family: 'Droid Sans', 'Helvetica Neue', 'Arial', 'sans-serif' !important;
- }
- }
- </style>
- <style media='only screen and (max-width: 480px)' type='text/css'>
- /* Mobile styles */
-
- @media only screen and (max-width: 480px) {
- table[class='w320'] {
- width: 320px !important;
- }
- td[class='mobile-block'] {
- width: 100% !important;
- display: block !important;
- }
- }
- </style>
- </head>
-
- <body bgcolor='#FFFFFF' class='body' style='padding:0; margin:0; display:block; background:#ffffff; -webkit-text-size-adjust:none'>
- <div style='width:0; opacity:0; max-height:0; mso-hide:all; overflow:hidden; float:left; display:none !important;''>
- Se ha realizado una solicitud de empleo desde la página web www.rake.mx
- </div>
-
- <table align='center' cellpadding='0' cellspacing='0' class='force-full-width'>
- <tbody>
- <tr>
- <td align='center' bgcolor='#FFFFFF' valign='top' width='100%'>
- <center>
- <table cellpadding='0' cellspacing='0' class='w320' style='margin: 0 auto;' width='600'>
- <tbody>
- <tr>
- <td align='center' valign='top'>
- <table bgcolor='#fff' cellpadding='0' cellspacing='0' class='force-full-width' style='margin: 0 auto;'>
- <tbody>
- <tr>
- <td style='font-size: 30px; text-align:center;padding: 10px;'>
- <img alt='Rake' class='500' height='70' src='http://rake.mx/webQA/assets/logo.png'>
- </td>
- </tr>
- </tbody>
- </table>
-
- <table bgcolor='#4DBFBF' cellpadding='0' cellspacing='0' class='force-full-width' style='margin: 0 auto;'>
- <tbody>
- <tr>
- <td><br>
- <img alt='robot picture' height='240' src='https://www.filepicker.io/api/file/carctJpuT0exMaN8WUYQ' width='224'>
- </td>
- </tr>
-
- <tr>
- <td class='headline'><br>
- <strong>Nueva Solicitud de Empleo </strong><br>
- </td>
- </tr>
-
- <tr>
- <td>
- <center>
- <table cellpadding='0' cellspacing='0' style='margin: 0 auto;' width='60%'>
- <tbody>
- <tr>
- <td style='font-size:18px;color:#fff;'><br> Se ha recibido una nueva solicitud de empleo desde la página web Rake MX<br>
- <br> Nombre: ".$nombreBolsa."
- <br> Teléfono: ".$numeroBolsa."
- <br> Correo electrónico: ".$correoBolsa."
- <br> Codigo Postal: ".$codigoPostal."
- <br> Ciudad: ".$ciudadBolsa."
- <br> Pais: ".$pais."
- <br> Comentarios: ".$comentariosBolsa."<br> <br>
-
- </td>
- </tr>
- </tbody>
- </table>
- </center>
- </td>
- </tr>
- <tr>
- <td>
-
- <br>
- <br>
- <br>
- <br>
- </td>
- </tr>
- </tbody>
- </table>
- <table bgcolor='#F5774E' cellpadding='0' cellspacing='0' class='force-full-width' style='margin: 0 auto;'>
- <tbody>
- <tr>
- <td style='background-color:#f5774e;'>
- <center></center>
- </td>
- </tr>
- </tbody>
- </table>
-
- <table bgcolor='#414141' cellpadding='0' cellspacing='0' class='force-full-width' style='margin: 0 auto;'>
- <tbody>
- <tr>
- <td style='background-color:#414141;'><br><br>
- </td>
- </tr>
-
- <tr>
- <td style='color:#bbbbbb; font-size:12px;'>
- <br>
- <br>
- </td>
- </tr>
- </tbody>
- </table>
- </td>
- </tr>
- </tbody>
- </table>
- </center>
- </td>
- </tr>
- </tbody>
- </table>
- </body>
- </html>";
- $body .= "\r\n\r\n--" . $uniqueid. "\r\n";
- $body .= "Content-Type: application/octet-stream; ";
- $body .= "name=" . $nameFile . "\r\n";
- $body .= "Content-Transfer-Encoding: base64\r\n";
- $body .= "Content-Disposition: attachment; ";
- $body .= "filename=" . $nameFile . "\r\n";
- $body .= "\r\n"; // línea vacía
- $fp = fopen($tempFile, "rb");
- $file = fread($fp, $sizeFile);
- $file = chunk_split(base64_encode($file));
- $body .= "$file\r\n";
- // Adjunto 2
- $body .= "\r\n\r\n--" . $uniqueid. "\r\n";
- $body .= "Content-Type: application/octet-stream; ";
- $body .= "name=" . $nameFile2 . "\r\n";
- $body .= "Content-Transfer-Encoding: base64\r\n";
- $body .= "Content-Disposition: attachment; ";
- $body .= "filename=" . $nameFile2 . "\r\n";
- $body .= "\r\n"; // línea vacía
- $fp2 = fopen($tempFile2, "rb");
- $file2 = fread($fp2, $sizeFile2);
- $file2 = chunk_split(base64_encode($file2));
- $body .= "$file2\r\n";
-
- $body .= "\r\n"; // línea vacía
- // Delimitador de final del mensaje.
-
- if(!mail($to,$subject,$body, $cabeceras)){
- controlError(false,"No se pudo enviar el email al administrador.");
- }else{
- controlError(success,"La solicitud de empleo ha sido enviada exitosamente.");
- }
-
- }
- function controlError($succes,$mensaje) {
- $response = array('success'=>$succes,'mensaje'=>$mensaje);
- echo json_encode($response);
- }
- ?>
|