title: Swift mail from Symfony Command
body: <p>I try to send a Swift mail from the commandline using a Symfony command. Though I get the following exception. </p>
  
  <pre><code>Fatal error: Call to undefined method Symfony\Bundle\TwigBundle\Debug\TimedTwigE
  ngine::renderView() in ...
  </code></pre>
  
  <p>A container is added to this class which I got from the command that is made <code>ContainerAwareCommand</code> </p>
  
  <p>The code of the function lookslike this:</p>
  
  <pre><code>private function sendViaEmail($content) {
      $message = \Swift_Message::newInstance()
              -&gt;setSubject('Hello Email')
              -&gt;setFrom('123@gmail.com')
              -&gt;setTo('123@gmail.com')
              -&gt;setBody(
              $this-&gt;container-&gt;get('templating')-&gt;renderView(
                      'BatchingBundle:Default:email.html.twig', array('content' =&gt; $content)
              )
      );
      $this-&gt;get('mailer')-&gt;send($message);
  }
  </code></pre>
  
  <p><strong>Update</strong>
  The line where the exception happens is <code>$this-&gt;container-&gt;get('templating')-&gt;renderView(</code></p>
  
  <p>As you can see in the code the last line would probably fail aswell as it finally gets there.</p>