Jump to content

[solved]Add a fix PDF to outgoing E-Mail


Recommended Posts

Hi Community,


according to german law i have to send several pdfs with my outgoing E-mails as attachment.


These PDFs are predefined and not generated instant for every customer.


I read about this topic and found out that it isn`t possible to add dynamic Pdfs.

But what about static PDFs? Seems not that hard to get it in there but don`t know how to.


Anyone got an idea where to start?


Thx a lot.


Edited by sm5k (see edit history)
Link to comment
Share on other sites

Assuming you have saved the PDF's on your server in a predefined folder, then I would edit the Mail class and add code that would attach these PDF's to every email that is sent.


This assumes you have to attach these PDF's to every single email.  If this is a wrong assumption, then please state exactly which emails you need to include these attachments in.

Link to comment
Share on other sites

Hi thank you for your answers. Found several issues on this topic.


I attached the following code on mail.php in /classes.


/* E-Mail Anhänge wiederrufsbelehrung und AGB -  */


$file = _PS_ROOT_DIR_ . '/yourfolderforemailattachments/test.pdf';
            $message->attach(new Swift_Message_Attachment(file_get_contents($file), 'test.pdf', 'application/pdf'));


 $file = _PS_ROOT_DIR_ . '/yourfolderforemailattachments/test2.pdf';
            $message->attach(new Swift_Message_Attachment(file_get_contents($file), 'test2.pdf', 'application/pdf'));

Works now :)


Greetz and thanx to everybody.


Link to comment
Share on other sites

This topic is now closed to further replies.
  • Create New...