Answers.Body: <p>Currently (Craft Commerce 1.1) there is no way to attach the PDF in an order status email, it can only be a link to download the PDF. For now, I suggest you make a feature request here: <a href="http://feedback.craftcms.com/forums/295386-commerce/filters/top" rel="nofollow">http://feedback.craftcms.com/forums/295386-commerce/filters/top</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-09T12:30:19.750Z
Answers.LastActivityDate: 2016-06-09T12:30:19.750Z
Answers.UserDisplayName: Luke Holder
Answers.Body: <p>You can send an email via your plugin's <code>init()</code> function like so:</p>
  
  <pre><code>craft()-&gt;on( 'email.onBeforeSendEmail', function( Event $event ){
      $email = $event-&gt;params['emailModel'];
      $attachment = array(
          'path'     =&gt; '/var/www/public/assets/downloads/filename.pdf',
          'name'     =&gt; 'File Title',
          'encoding' =&gt; 'base64',
          'type'     =&gt; 'application/pdf'
      );
      $email-&gt;addAttachment($attachment['path'], $attachment['name'], $attachment['encoding'], $attachment['type']);
  });
  </code></pre>
  
  <p>Obviously, you'll want to do some checks on the <code>Event</code> and pass that off to a service to determine the logic for what should actually be attached.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-06T03:19:02.077Z
Answers.LastActivityDate: 2017-04-06T03:19:02.077Z
Answers.UserDisplayName: casey
Body: <p>I am currently adding a link to download the order PDF in the confirmation email with <code>{{ order.getPdfUrl() }}</code> but also want this to be an attachment.</p>
  
Tags: <templating><plugin-craftcommerce><pdf>
Title: How to attach an order PDF in an order confirmation email?
ThreadText: # How to attach an order PDF in an order confirmation email?
  
  (Asked by: username_0 on 2016-06-07)
  
  I am currently adding a link to download the order PDF in the confirmation email with `{{ order.getPdfUrl() }}` but also want this to be an attachment.
  
  **Tags:** templating, plugin-craftcommerce, pdf
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-06-09. Score: 1 | Accepted answer
  
  Currently (Craft Commerce 1.1) there is no way to attach the PDF in an order status email, it can only be a link to download the PDF. For now, I suggest you make a feature request here: <http://feedback.craftcms.com/forums/295386-commerce/filters/top>
  
  
  ---
  
  ### Answer by username_2 on 2017-04-06. Score: 2
  
  You can send an email via your plugin's `init()` function like so:
  
  ```
  craft()->on( 'email.onBeforeSendEmail', function( Event $event ){
      $email = $event->params['emailModel'];
      $attachment = array(
          'path'     => '/var/www/public/assets/downloads/filename.pdf',
          'name'     => 'File Title',
          'encoding' => 'base64',
          'type'     => 'application/pdf'
      );
      $email->addAttachment($attachment['path'], $attachment['name'], $attachment['encoding'], $attachment['type']);
  });
  
  ```
  
  Obviously, you'll want to do some checks on the `Event` and pass that off to a service to determine the logic for what should actually be attached.
  
  
  ---
  
  