Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once("PHPMailerAutoload.php");
- /**
- * Description of notificacionClass
- *
- * @author vanessa.pazminm
- */
- class notificacionClass {
- function __construct() {
- }
- public function EnviarCorreo($titulo, $codigo, $correousuario, $caso, $ishtml = true, $foto, $ruta) {
- $mail = new PHPMailer(true);
- $mail->SMTPOptions = array(
- 'ssl' => array(
- 'verify_peer' => false,
- 'verify_peer_name' => false,
- 'allow_self_signed' => true
- )
- );
- $mail->SMTPDebug = 0;
- $mail->IsSMTP();
- $mail->SMTPAuth = true;
- $mail->SMTPSecure = "ssl";
- $mail->SMTPSecure = 'tls';
- $mail->Host = 'mailen2.cloudsector.net'; // se debe cambiar esto
- $mail->Port = 25; // TCP port to connect to // se debe cambiar esto
- $mail->CharSet = 'UTF-8';
- $mail->Username = 'auxsistemasbuga@frigometro.com'; //Email para enviar // se debe cambiar esto
- $mail->Password = '.AsistemasBG-01.'; //Su password // se debe cambiar esto
- //Agregar destinatario
- $mail->setFrom('auxsistemasbuga@frigometro.com', 'Sistemas'); // se debe cambiar esto
- $mail->AddAddress('auxsistemasbuga@frigometro');
- $mail->AddAddress('auxsistemasbuga@frigometro.com'); //A quien mandar email
- $mail->SMTPKeepAlive = true;
- $mail->Mailer = "smtp";
- //Content
- $mail->isHTML(true); // Set email format to HTML
- $mail->Subject = 'Solicitud de tipo: ' . $titulo;
- $mail->Body = 'This is the HTML message body <b>in bold!</b> ' . $caso . 'su codigo de solicitud es: ' . $codigo;
- //$mail->AltBody = 'This is the body in plain text for non-HTML mail clients'.$codigo;
- $archivo = $foto;
- //Attachments
- $mail->addAttachment($ruta, $foto); // Add attachments
- if (!$mail->send()) {
- echo 'Error al enviar email';
- echo 'Mailer error: ' . $mail->ErrorInfo;
- } else {
- echo 'Mail enviado correctamente';
- }
- }
- public function generarCodigo($longitud) {
- $key = '';
- $pattern = '1234567890abcdefghijklmnopqrstuvwxyz';
- $max = strlen($pattern) - 1;
- for ($i = 0; $i < $longitud; $i++)
- $key .= $pattern{mt_rand(0, $max)};
- return $key;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement