I happen to have a code that generates pdfs perfectly with the fpd library. But at the end of this, I added another library with its corresponding code to send me this pdf generated by mail with PHPMailer, and what happens is that it sends me the email and the pdf, but empty and when it opens it tells me that the file is damaged and therefore I can not open it. This is my code.
<?php
$outmail = $pdf->Output('','FichaCETis26.pdf');
require("class.phpmailer.php");
require("class.smtp.php");
$correo=$_POST['CORREO'];
$mail = new PHPMailer;
//Config SMTP
$mail->isSMTP();
$mail->CharSet='utf-8';
$mail->Host='mail.cetis26.edu.mx';
$mail->SMTPAuth=true;
$mail->Username='[email protected]';
$mail->Password='**********';
$mail->SMTPSecure='TLS';
$mail->Port=26;
$mail->setLanguage('es');
$mail->From = '[email protected]';
$mail->FromName='Cetis26';
$mail->Subject='Pase de ingreso al examen otra vez alv.';
$mail->isHTML(true);
$mail->Body="Hola, este es tu pase de ingreso al examen.";
$mail->AddAddress($correo);
$mail->AddStringAttachment($outmail,'FichaCETis26.pdf');
$mail->Send();
?>
What I am doing is that, first I generate the pdf and then send it by mail, all in the same file, I just need the pdf to be complete, when I download it and I want to open it, it says it is damaged and it can not be opened I would really appreciate it if you could help me, thank you very much and happy holidays!