1
I am using Phpmailer to perform email sending more I would like to know why when I try to create a PDF attachment the file does not open right, With the upload everything is normal, up to the pdf and generated, but does not open. this function below that I am trying to make run.
$mail->addStringAttachment(file_get_contents('teste.php'), 'myfile.pdf');
Fabio, to get around the problem, create a . pdf with the TCPDF class (http://www.tcpdf.org/). This way you will first generate . pdf with TCPDF then attach with Phpmailer class normally as you are doing.
– Thyago ThySofT
to half lost here to join mount the class in phpmaille. would have some example?
– Fabio Henrique
The individual working classes managed to generate the PDF with the TCPDF class? It would look like this:
$arquivo = $pdf->Output('arquivo.pdf','S');
then yes attach in Phpmailer:$mail->addStringAttachment($arquivo, 'myfile.pdf');
– Thyago ThySofT