title: How to attach PDF to email using Swiftmailer in Symfony2
body: <p>I am sending an email using swiftmailer in symfony2, but I would like to add a specified PDF file as a file attachment to the email. How would I do that?</p>
  
  <p>Here is my current code:</p>
  
  <pre><code>$message = \Swift_Message::newInstance()
      -&gt;setSubject('Hello Email')
      -&gt;setFrom('send@example.com')
      -&gt;setTo('recipient@example.com')
      -&gt;setBody(
          $this-&gt;renderView(
              'HelloBundle:Hello:email.txt.twig',
              array('name' =&gt; $name)
          )
      )
  ;
  $this-&gt;get('mailer')-&gt;send($message);
  </code></pre>