Skip to content
Advertisement

Attach excel stream to swiftmailer message?

I’m trying to attach an Excel file in a SwiftMailer message.

The trick is that I don’t want to save the excel file and then attach it and then delete it, instead I just want to generate the excel and attach that to the message.

This function allows to attach a OutputByteStream

JavaScript

There is a function in Symfony PHPExcel bundle to create the response

JavaScript

They seems to call to that callback when they are rendering the reponse, but How can I save the php://output in a variable or something to pass it to newInstance method?

I tried passing the response object (StreamedResponse) but it only have the headers, I also tried with $response->getContent() and passing $writer->save(‘php://output’) to newInstance method.

Advertisement

Answer

use stream_get_contents

JavaScript

(dont know hat your actual mimetype is)

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement