I have already tried several solutions, the closest (for me) should look like this:
$file = $pdf->Output('', 'E'); $message->attach(Swift_Attachment::newInstance($file, 'name.pdf', 'application/pdf'));
$pdf is an instance of TCPDF and $message is an instance of Swift_Message . Using the above, the message is sent normally, the file is connected, but when I try to open it, I get an error message that the file is damaged or badly encoded.
My question is: how to send the PDF created by TCPDF as an Swiftmailer attachment without saving the file on the server and deleting it after sending the email . Here is a link to the documentation of the TCPDF output method, maybe someone can see something that I missed.
matino
source share