correo.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. include_once('./include/xTemplate/xtemplate.class.php');
  3. include_once('./classes/Mailer.php');
  4. if(!isset($_GET["correo"])){
  5. echo "Debes especificar la dirección a la que se enviará el correo <strong>?correo=</strong>";
  6. exit();
  7. }
  8. $txtCont = $_GET["txt"];
  9. $xtpl = new XTemplate('avisos.html');
  10. $xtpl->assign("CONTENIDO",$txtCont);
  11. $xtpl->parse("main");
  12. $correo = $_GET["correo"];
  13. //$msgInfo = "<h1>Esto es una prueba automatizada</h1><p>El correo se envió atutomáticamente, no debes hacer nada más.</p>";
  14. Mailer::enviarCorreo($correo,"Correo de prueba 2",$xtpl->text("main"));
  15. echo "Enviado!".date("H:i:s");
  16. /*
  17. try{
  18. //SMTP Settings
  19. $mail = new PHPMailer();
  20. $mail->CharSet = 'UTF-8';
  21. $mail->SMTPDebug = 0;
  22. $mail->SetFrom("info.ingenieria@lasalle.mx", "Correo automático"); //from (verified email address)
  23. $mail->Subject = "Correo de prueba"; //subject
  24. $mail->SMTPDebug = 1;
  25. $mail->isSMTP();
  26. $mail->SMTPAuth = true;
  27. $mail->SMTPSecure = 'TLS';
  28. $mail->Host = "smtp.office365.com";
  29. $mail->Port = 587;
  30. $mail->Username = 'info.ingenieria@lasalle.mx';
  31. $mail->Password = 'BDp71Fp8';
  32. $mail->IsHTML(true);
  33. $mail->MsgHTML($msgInfo);
  34. //recipient
  35. $mail->AddAddress($correo);
  36. //Success
  37. if ($mail->Send()) {
  38. echo "El correo ha sido enviado";
  39. }else{
  40. echo "Ocurrió un error al enviar tu información. Recarga la página e intentalo nuevamente.";
  41. }
  42. }catch(phpmailerException $e){
  43. echo "<h1>Error!!</h1>";
  44. echo $e->errorMessage();
  45. }*/
  46. ?>