File "enviar.php"
Full Path: C:/wamp64/www/PAGOS-T3/mail/phpMailer/enviar.php
File size: 1.23 KB
MIME-type: text/x-php
Charset: utf-8
<?php
//Librerías para el envío de mail
include_once('class.phpmailer.php');
include_once('class.smtp.php');
//Recibir todos los parámetros del formulario
$para = $_POST['email'];
$asunto = $_POST['asunto'];
$mensaje = $_POST['mensaje'];
$archivo = $_FILES['hugo'];
//Este bloque es importante
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
//Nuestra cuenta
$mail->Username ='arestrepo240@gmail.com';
$mail->Password = 'ZULUAGA.RESTREPO.240'; //Su password
//Agregar destinatario
$mail->AddAddress($para);
$mail->Subject = $asunto;
$mail->Body = $mensaje;
//Para adjuntar archivo
$mail->AddAttachment($archivo['tmp_name'], $archivo['name']);
$mail->MsgHTML($mensaje);
//Avisar si fue enviado o no y dirigir al index
if($mail->Send())
{
echo'<script type="text/javascript">
alert("Enviado Correctamente");
window.location="http://localhost/maillocal/index.php"
</script>';
}
else{
echo'<script type="text/javascript">
alert("NO ENVIADO, intentar de nuevo");
window.location="http://localhost/maillocal/index.php"
</script>';
}
?>