title: CakeEmail::viewVars - CakePHP
body: <p>I am trying to set the variable $purchase to use in my email template per the following configuration:</p>
  
  <pre><code>App::uses('CakeEmail', 'Network/Email');
  $email = new CakeEmail();
  $email-&gt;emailFormat('html');
  $email-&gt;template('new_order_email', 'default');
  $email-&gt;from(array('info@mydomain.com' =&gt; 'A Great Site'));
  $email-&gt;to($this-&gt;request-&gt;data['email']);
  $email-&gt;subject('Order details');
  $email-&gt;viewVars($purchase);
  $email-&gt;send();
  </code></pre>
  
  <p>But this doesn't work when I attempt to use the $purchase variable in the template. Instead, the email which is sent contains the following error:</p>
  
  <blockquote>
    <p>Notice (8): Undefined variable: purchase
    [APP/View/Emails/html/new_order_email.ctp, line 2]</p>
  </blockquote>
  
  <p>This indicates that $purchase is not available, even though I did set that variable using the CakeEmail:viewVars(); function. Any ideas why I am having this problem?</p>