2

Im trying to send the sales order email with three attached PDF files. At first i need to attach the terms/conditions for b2b and b2c but the cancellation policy also.

I searched a while and just found the "FOOMAN EMAIL ATTACHMENTS" where i cant attach more than just one file.

Maybe someone got a similar problem and could tell me how to realize this?

2

If you are already using our Email Attachments extension you can make use of the event it emits to add additional attachments (this is how the extension itself does it). For the order confirmation email you would listen for the event fooman_emailattachments_before_send_order and then in your event observer class you can use something like this:

public function beforeSendOrder($observer)
{
    $filePath = 'full/path/to/file.pdf';
    $mailTemplate = $observer->getEvent()->getTemplate();
    $mailTemplate->getMail()->createAttachment(
        file_get_contents($filePath),
        'application/pdf',
        Zend_Mime::DISPOSITION_ATTACHMENT,
        Zend_Mime::ENCODING_BASE64,
        basename($filePath)
    );
}
  • Hey, i'm using Magento 2 fooman email attachments. How i use this observer event to attach multiple pdf. – Mayank Tailor Jun 1 '18 at 6:29
  • It's the same event name, and then take a look \Fooman\EmailAttachments\Observer\AbstractObserver. – Kristof at Fooman Jun 3 '18 at 23:46
  • Hi, thanks i found it. and working perfectly. – Mayank Tailor Jun 4 '18 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.