datos=array(); $this->datos=$this->datosParticipante($email); } public function sendEmail($destinatario, $correoEmisor ,$nombreEmisor, $contrasena,$mensaje=null) { $mail = new PHPMailer\PHPMailer\PHPMailer(true); // Passing `true` enables exceptions $mail->CharSet="UTF-8"; try { //Server settings $mail->SMTPOptions = array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ) ); $mail->SMTPDebug = 0; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'apolo.acatlan.unam.mx'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = $correoEmisor; // SMTP username $mail->Password = $contrasena; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; // TCP port to connect to $mail->Mailer = "smtp"; //Recipients $mail->setFrom($correoEmisor, $nombreEmisor); $mail->addAddress($destinatario); // Add a recipient //$mail->addAddress('ellen@example.com'); // Name is optional //$mail->addReplyTo('info@example.com', 'Information'); //$mail->addCC('cc@example.com'); //$mail->addBCC('bcc@example.com'); //Attachments //$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments //$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name //Content $mail->isHTML(true); // Set email format to HTML $mail->Subject = 'Boleto para desayuno con egresados FES Acatlán'; $mail->Body = '

Estimado(a) Egresado(a):

A través de este medio le hago llegar el boleto para el Magno Desayuno Multidisciplinario para Egresados de la FES Acatlán.

Le solicitamos que imprima el archivo anexo y lo presente el día sábado 27 de octubre a las 8:15 hrs en el Centro de Estudios Municipales y Metropolitanos de la FES Acatlán.

Para cualquier duda o comentario, estoy a sus órdenes en el teléfono 56231665.

'; $mail->AltBody = 'Estimado(a) Egresado(a): A través de este medio le hago llegar el boleto para el Magno Desayuno Multidisciplinario para Egresados de la FES Acatlán. Le solicitamos que imprima el archivo anexo y lo presente el día sábado 27 de octubre a las 8:15 hrs en el Centro de Estudios Municipales y Metropolitanos de la FES Acatlán. Para cualquier duda o comentario, estoy a sus órdenes en el teléfono 56231665. Gloria Moctezuma Nájera. Secretaria Técnica de la Secretaría de Extensión Universitaria y Vinculación Institucional. Facultad de Estudios Superiores Acatlán. Universidad Nacional Autónoma de México. '; $mail->addStringAttachment($this->pdf(), 'Boleto_Megadesayuno.pdf'); $mail->send(); return 1; } catch (Exception $e) { return $mail->ErrorInfo; } } function pdf() { require __DIR__.("/../reportes/mc_table.php"); //$pdf = new PDF_MC_Table(); //$pdf->Image(__DIR__."/../images/logo_dsc.png", 5, 5, 0, 0); $pdf = new PDF_MC_Table('P','mm',array(200,200)); $pdf->AddPage(); //$pdf->Image("images/logo_dsc.png", 5, 5, 0, 0); foreach ($this->datos as $datos) { //$pdf->SetFont('Arial','B',12); //$pdf->Cell(0, 0, utf8_decode('Fecha de solicitud:')." ".$fecha, 0, 1, 'R'); //$pdf->ln(8); //$pdf->SetFont('Arial','B',12); //$pdf->Cell(0, 0, utf8_decode('Número de solicitud:')." ".$datos['id_registro'], 0, 1, 'R'); $pdf->ln(10); $pdf->SetFont('Arial', 'B', 12); $pdf->Cell(0, 0, utf8_decode('Nombre:'), 0, 1, 'L'); $pdf->SetFont('Arial', '', 12); $pdf->Cell(0, 0, $datos['nombre_completo'], 0, 1, 'C'); $pdf->ln(10); $pdf->SetFont('Arial', 'B', 12); $pdf->Cell(0, 0, utf8_decode('e-mail:'), 0, 1, 'L'); $pdf->SetFont('Arial', '', 12); $pdf->Cell(0, 0, $datos['correo'], 0, 1, 'C'); $pdf->ln(10); $pdf->SetFont('Arial', 'B', 12); $pdf->Cell(0, 0, utf8_decode('Generación:'), 0, 1, 'L'); $pdf->SetFont('Arial', '', 12); $pdf->Cell(0, 0, $datos['generacion'], 0, 1, 'C'); $pdf->ln(10); $pdf->SetFont('Arial', 'B', 12); $pdf->Cell(0, 0, utf8_decode('Carrera:'), 0, 1, 'L'); $pdf->SetFont('Arial', '', 12); $pdf->Cell(0, 0, $datos['carrera'], 0, 1, 'C'); $pdf->ln(10); $pdf->SetFont('Arial', 'B', 12); $pdf->Cell(0, 0, utf8_decode('Asignado a mesa:'), 0, 1, 'L'); $pdf->SetFont('Arial', '', 12); $pdf->Cell(0, 0, $datos['mesa'], 0, 1, 'C'); $pdf->ln(10); $pdf->SetFont('Arial', '', 12); $pdf->Cell(0, 0, $datos['sistema'], 0, 1, 'C'); $pdf->ln(12); $pdf->Cell(0, 0, "", 1, 1, 'L'); $pdf->ln(12); $pdf->SetFont('Arial', 'B', 40); $pdf->Cell(0, 0, utf8_decode('MAGNO DESAYUNO'), 0, 1, 'L'); $pdf->ln(12); $pdf->SetFont('Arial', 'B', 16.5); $pdf->Cell(0, 0, utf8_decode('MULTIDISCIPLINARIO PARA EGRESADOS DE LA'), 0, 1, 'L'); $pdf->ln(12); $pdf->SetFont('Arial', 'B', 38); $pdf->Cell(0, 0, utf8_decode('FES ACATLÁN UNAM'), 0, 1, 'L'); $pdf->ln(12); $pdf->SetFont('Arial', 'B', 15); $pdf->Cell(0, 0, utf8_decode('CENTRO DE ESTUDIOS MUNICIPALES'), 0, 1, 'L'); $pdf->ln(8); $pdf->SetFont('Arial', 'B', 15); $pdf->Cell(0, 0, utf8_decode('Y METROPOLITANOS'), 0, 1, 'L'); $pdf->ln(8); $pdf->SetFont('Arial', 'B', 15); $pdf->Cell(0, 0, utf8_decode('27 octubre 2018 - 8:15 horas'), 0, 1, 'L'); $pdf->ln(8); $pdf->SetFont('Arial', 'B', 15); $pdf->Cell(0, 0, utf8_decode('DONATIVO $350.00'), 0, 1, 'L'); $pdf->ln(8); $pdf->SetFont('Arial', '', 10); $pdf->Cell(0, 0, utf8_decode('CUPO LIMITADO'), 0, 1, 'L'); $pdf->ln(8); $pdf->SetFont('Arial', '', 12); $pdf->Code39(80, 160, $datos['id_registro'], 1, 13); //Código de barras $pdf->ln(10); } //mysqli_close($con); //$pdf->Output(); return $pdfdoc = $pdf->Output('', 'S'); } function datosParticipante($email) { $datos = []; $con = Conectarse(); $query = "call st_trae_boleto('$email')"; $resultado = mysqli_query($con, $query); while($row = mysqli_fetch_assoc($resultado)) { $datos[] = $row; } mysqli_close($con); return $datos; } function __destruct() { $this->datos=null; } } ?>