Advertisement
Guest User

Untitled

a guest
Sep 4th, 2018
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. <?php
  2.  
  3. require_once("PHPMailerAutoload.php");
  4.  
  5. /**
  6. * Description of notificacionClass
  7. *
  8. * @author vanessa.pazminm
  9. */
  10. class notificacionClass {
  11.  
  12. function __construct() {
  13. }
  14.  
  15. public function EnviarCorreo($titulo, $codigo, $correousuario, $caso, $ishtml = true, $foto, $ruta) {
  16.  
  17. $mail = new PHPMailer(true);
  18. $mail->SMTPOptions = array(
  19. 'ssl' => array(
  20. 'verify_peer' => false,
  21. 'verify_peer_name' => false,
  22. 'allow_self_signed' => true
  23. )
  24. );
  25. $mail->SMTPDebug = 0;
  26. $mail->IsSMTP();
  27. $mail->SMTPAuth = true;
  28. $mail->SMTPSecure = "ssl";
  29. $mail->SMTPSecure = 'tls';
  30. $mail->Host = 'mailen2.cloudsector.net'; // se debe cambiar esto
  31. $mail->Port = 25; // TCP port to connect to // se debe cambiar esto
  32. $mail->CharSet = 'UTF-8';
  33. $mail->Username = 'auxsistemasbuga@frigometro.com'; //Email para enviar // se debe cambiar esto
  34. $mail->Password = '.AsistemasBG-01.'; //Su password // se debe cambiar esto
  35. //Agregar destinatario
  36. $mail->setFrom('auxsistemasbuga@frigometro.com', 'Sistemas'); // se debe cambiar esto
  37. $mail->AddAddress('auxsistemasbuga@frigometro');
  38. $mail->AddAddress('auxsistemasbuga@frigometro.com'); //A quien mandar email
  39. $mail->SMTPKeepAlive = true;
  40. $mail->Mailer = "smtp";
  41.  
  42.  
  43. //Content
  44. $mail->isHTML(true); // Set email format to HTML
  45. $mail->Subject = 'Solicitud de tipo: ' . $titulo;
  46. $mail->Body = 'This is the HTML message body <b>in bold!</b> ' . $caso . 'su codigo de solicitud es: ' . $codigo;
  47. //$mail->AltBody = 'This is the body in plain text for non-HTML mail clients'.$codigo;
  48. $archivo = $foto;
  49. //Attachments
  50. $mail->addAttachment($ruta, $foto); // Add attachments
  51.  
  52. if (!$mail->send()) {
  53. echo 'Error al enviar email';
  54. echo 'Mailer error: ' . $mail->ErrorInfo;
  55. } else {
  56. echo 'Mail enviado correctamente';
  57. }
  58. }
  59.  
  60. public function generarCodigo($longitud) {
  61. $key = '';
  62. $pattern = '1234567890abcdefghijklmnopqrstuvwxyz';
  63. $max = strlen($pattern) - 1;
  64. for ($i = 0; $i < $longitud; $i++)
  65. $key .= $pattern{mt_rand(0, $max)};
  66. return $key;
  67. }
  68.  
  69. }
  70. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement