Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Create your file contents in the normal way, but don't write them to disk
- $data = create_my_pdf_data();
- // Create the attachment with your data
- $attachment = Swift_Attachment::newInstance($data, 'my-file.pdf', 'application/pdf');
- // Attach it to the message
- $message->attach($attachment);
- // You can alternatively use method chaining to build the attachment
- $attachment = Swift_Attachment::newInstance()
- ->setFilename('my-file.pdf')
- ->setContentType('application/pdf')
- ->setBody($data)
- ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement