<?php
include("mailer/src/PHPMailer.php");
include("mailer/src/SMTP.php");
include("mailer/src/Exception.php");


   try {

          $emailTo = $_POST["correo"];
          $subject = $_POST["asunto"];
          $bodyEmail = $_POST["mensaje"];



      	 $fromemail = "jrobles@sanmatias.mx";
      	 $fromname = "Inventario";
      	 $host = "mail.sanmatias.mx";
      	 $port = "587";
      	 $SMTPAuth = "login";
      	 $SMTPSecure = "";
      	 $password = "P@88w0rd.0";
   	 



   	    $mail = new PHPMailer\PHPMailer\PHPMailer();
   	

           $mail->isSMTP();
           $mail->SMTPDebug = 0;
           $mail->Host = $host;
           $mail->Port = $port;
           $mail->SMTPAuth = $SMTPAuth;
           $mail->SMTPSecure = $SMTPSecure;
           $mail->Username = $fromemail;
           $mail->Password = $password;


           $mail->setFrom($fromemail, $fromname);
           $mail->addAddress($emailTo);

       
           $mail->isHTML(true);
           $mail->Subject = $subject;
           $mail->Body = $bodyEmail;
    
    
     if (!$mail->send() ) { 
     	echo "No pudo enviar el correo"; die();
        }

           echo"Correo enviado con exito"; die();

   } catch (Exception $e) {
   	
   }



?>