| Server IP : 52.9.100.119 / Your IP : 216.73.216.135 Web Server : Apache/2.4.61 (Amazon) OpenSSL/1.0.2k-fips PHP/7.3.30 Phusion_Passenger/5.1.5 System : Linux ip-172-31-9-35 4.14.355-196.618.amzn1.x86_64 #1 SMP Mon Apr 7 17:09:50 UTC 2025 x86_64 User : root ( 0) PHP Version : 7.3.30 Disable Function : exec,passthru,shell_exec,system,popen,proc_open MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /data/html/focusbk/ |
Upload File : |
<?php
// Import PHPMailer classes into the global namespace
// These must be at the top of your script, not inside a function
require 'vendor/autoload.php';
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
$data = json_decode(file_get_contents("php://input"));
if (!empty($data->honeypot)) {
echo "Honeypot field should be empty.";
return;
}
$recaptcha_response = $data->token;
// set the secret key
$secret_key = '6LexeRosAAAAANZ2mZMW2RAOY-H4Svu0Ciz2TqRn';
// send the secret key and the generated token to recaptcha API
$response = file_get_contents( "https://www.google.com/recaptcha/api/siteverify?secret={$secret_key}&response={$recaptcha_response}" );
$response_data = json_decode( $response );
if ( $response_data->success ) {
$mail = new PHPMailer(true);
// Specify your SSL options
//$mail->SMTPOptions = array(
// 'ssl' => array(
// 'verify_peer' => true,
// 'verify_peer_name' => true,
// 'allow_self_signed' => false,
// 'cafile' => 'vendor/config/cacert.pem', // Specify the path to your CA certificates file
// )
//);
// Passing `true` enables exceptions
try {
//Server settings
// $mail->SMTPDebug = true; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp-relay.brevo.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = '9059ba001@smtp-brevo.com'; // SMTP username
$mail->Password = 'xsmtpsib-4b11514ec0d703822ccae9d31d3e38b24f5506a0a460ece991a02a3802644bf0-QiiNEncekiNn79NX';
$mail->SMTPSecure = "tls"; //Enable implicit TLS encryption
$mail->Port = 587;
$mail->CharSet = "UTF-8";
//Content
$nombre = $data->nombre;
$cargo = $data->cargo;
$empresa = $data->empresa;
$ubicacion = $data->ubicacion;
$correo = $data->correo;
$telefono = $data->telefono;
$mensaje = $data->mensaje;
$download = $data->download;
$mail->setFrom('mensajes@focus-intel.com', 'Correo Contacto Focus');
$recipients = [
'contactotij@focus.com.mx',
'juancarlos@focus.com.mx',
'asistentedireccion@focus.mx',
'edgarjsolorio@gmail.com',
'natalia@quattro.marketing'
];
//$recipients = [
// 'mayral.lizarraga@gmail.com'];
foreach ($recipients as $email) {
$mail->addAddress($email);
}
$mail->isHTML(true);
$mail->addBCC('mlizarraga@quattromg.com');
if (empty($data->download))
$mail->Subject = 'Correo de contacto Sitio Web';
else
$mail->Subject = 'Correo descarga PDF Sitio Web';
if (empty($data->download)){
$mail->Body = '
<html>
<head>
<style>
body {
font-family: Arial, sans-serif;
color: #333;
}
table {
width: 100%;
border-collapse: collapse;
}
th, td {
padding: 10px;
border: 1px solid #ddd;
text-align: left;
}
th {
background-color: #f2f2f2;
}
</style>
</head>
<body>
<table>
<tr>
<th colspan="2">Información de Contacto</th>
</tr>
<tr>
<td><b>Nombre y Apellido:</b></td>
<td>' . htmlspecialchars($nombre, ENT_QUOTES, 'UTF-8') . '</td>
</tr>
<tr>
<td><b>Teléfono:</b></td>
<td>' . htmlspecialchars($telefono, ENT_QUOTES, 'UTF-8') . '</td>
</tr>
<tr>
<td><b>Correo:</b></td>
<td>' . htmlspecialchars($correo, ENT_QUOTES, 'UTF-8') . '</td>
</tr>
<tr>
<td><b>Cargo:</b></td>
<td>' . htmlspecialchars($cargo, ENT_QUOTES, 'UTF-8') . '</td>
</tr>
<tr>
<td><b>Empresa:</b></td>
<td>' . htmlspecialchars($empresa, ENT_QUOTES, 'UTF-8') . '</td>
</tr>
<tr>
<td><b>Ubicación:</b></td>
<td>' . htmlspecialchars($ubicacion, ENT_QUOTES, 'UTF-8') . '</td>
</tr>
<tr>
<td><b>Mensaje:</b></td>
<td>' . htmlspecialchars($mensaje, ENT_QUOTES, 'UTF-8') . '</td>
</tr>
</table>
</body>
</html>';
} else {
$mail->Body = '
<html>
<head>
<style>
body {
font-family: Arial, sans-serif;
color: #333;
}
table {
width: 100%;
border-collapse: collapse;
}
th, td {
padding: 10px;
border: 1px solid #ddd;
text-align: left;
}
th {
background-color: #f2f2f2;
}
</style>
</head>
<body>
<table>
<tr>
<th colspan="2">Información de Contacto</th>
</tr>
<tr>
<td><b>Nombre y Apellido:</b></td>
<td>' . htmlspecialchars($nombre, ENT_QUOTES, 'UTF-8') . '</td>
</tr>
<tr>
<td><b>Correo:</b></td>
<td>' . htmlspecialchars($correo, ENT_QUOTES, 'UTF-8') . '</td>
</tr>
</table>
</body>
</html>';
}
$mail->send();
http_response_code(200);
echo 200;
} catch (Exception $e) {
echo 'Mailer Error: ' . $mail->ErrorInfo;
}
}
?>