<?php
//enviar mail
include "phpmailer/class.phpmailer.php";
include "phpmailer/class.smtp.php";

$email_user = "AKIATDZTTWFOORJK72OW";
$email_password = "CsSMVLcMgp/qz3WF2OXUmaFbogbqIlSB/WLklQIx";
$the_subject = "Nuevo mensaje del formulario de contacto | INDEVAL";
$address_to = 'odnam93@gmail.com';
$from_name = "Indeval";
$phpmailer = new PHPMailer();
$phpmailer->CharSet = 'UTF-8';

// ---------- datos de la cuenta de Gmail -------------------------------
$phpmailer->Username = $email_user;
$phpmailer->Password = $email_password; 
//-----------------------------------------------------------------------
// $phpmailer->SMTPDebug = 1;
$phpmailer->SMTPSecure = 'ssl';
$phpmailer->Host = "email-smtp.us-east-1.amazonaws.com"; // GMail
$phpmailer->Port = 465;
$phpmailer->IsSMTP(); // use SMTP
$phpmailer->SMTPAuth = true;

$phpmailer->setFrom($phpmailer->Username,$from_name);
$phpmailer->AddAddress($address_to); // recipients email
$phpmailer->addBCC('armando@wearetrafika.com');

$phpmailer->Subject = $the_subject;	
$phpmailer->Body .= '
  <body style="background-color:#2b4365;">
    <table border=0 width="90%" style="border: 2px solid #2b4365; font-family: Century gothic, Helvetica, sans-serif;color:#2b4365;font-size: 15px;background-color: #ebebee;max-width: 700px;padding: 40px 20px;border-radius: 20px;position: relative;margin: 0 auto;top: 1em; text-align:center;">
          <tr><td align="center">
          <img src="https://indeval-webdocs-publico-01122020.s3.amazonaws.com/img/indeval_logo.png" alt="Indeval" style="width:200px; margin: 0px auto 20px;"/>
          </td></tr>

          <tr><td align="center" height="200">
          <h3 style="color:#2b4365; foont-weight:bold; text-align:center;">NUEVO MENSAJE</h3>
  
          <div style="text-align:left; color:#444; margin-top:20px; width:80%;background-color: #eee;
          border-radius: 30px;
          padding: 30px;">
          <p><b>Nombre: </b> '.$nombre.'</p>

          <p><b>Correo: </b> '.$correo.'</p>

          <p><b>Empresa: </b> '.$empresa.'</p>

          <p><b>Mensaje: </b><br><br> '.$mensaje.'</p>

          <br><br>

          <p><b>Fecha y Hora de envío:</b> '.date("d-m-Y h:i:s").'</p>
        

          </td></tr>							 
    </table>
    
  </body>
';
$phpmailer->IsHTML(true);
    
if(!$phpmailer->Send()) {
  echo "Error: " . $phpmailer->ErrorInfo;

  echo "<p class='errormsg'>Ocurrió un error al enviar el correo, intente nuevamente en unos minutos.</p> ";
} 
else {
  //echo "Correo enviado a".$EmailEnvio;
  echo $sucess;
}
//termina mail