0

I have module commerce billy mail working. Additionally to the invoice PDF that is attached to the mail, I would like to send two more files (terms & conditions and a price list).

Here's the function _commerce_billy_mail_get_attachments from the file commerce_billy_mail.module, it seems to be the appropriate function (?), but I don't know how to add the additional files:

function _commerce_billy_mail_get_attachments($order) {
  $attachments = array();

  list($html, $filename) = commerce_billy_mail_pdf_prepare($order);
  $pdf_filecontent = commerce_billy_mail_pdf_create($html, $filename);
  $filemime = 'application/pdf';
  $attachments[] = array(
    'filecontent' => $pdf_filecontent, // we use a dynamically created file.
    'filename' => $filename, // can use any alias name here
    'name' => $filename, // required for mandril and other libraries.
    'filemime' => $filemime, // mime file type
    'type' => $filemime, // required for mandril and other libraries
    'list' => TRUE,
  );

  return $attachments;
}

Hope someone can help out!

1

I found out, how to attach multiple Attachments:

  $attachments[] = array(
    'filename' => 'MyDoc.pdf', // can use any alias name here
    'name' => 'MyDoc.pdf', // required for mandril and other libraries.
    'filemime' => 'application/pdf', // mime file type
    'type' => 'application/pdf', // required for mandril and other libraries
    'list' => TRUE,
    'filepath' => 'sites/default/files/mail_attachments/MyDoc.pdf',
  );

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.