title: Cakephp - How to loop through array in email template?
body: <p>I am able to set the viewVars for a single record and mail it successfully. A problem occurs when I want to send an email containing more than one record. I find the correct records and I am able to pass them to my mail function. The problem comes in that when I debug the array passed to the mail template, I get a </p>
  
  <pre><code>Notice (8): Undefined variable: vars [APP\View\Emails\html\latest_projects.ctp, line 1]
  </code></pre>
  
  <p>However, just below the error, it does show me the information I want:</p>
  
  <pre><code>(int) 0 =&gt; array(
      'Project' =&gt; array(
          'id' =&gt; '809',
          'created' =&gt; '2014-04-23',
          'project_number' =&gt; 'SPN00000809',
      )
  ),
  (int) 1 =&gt; array(
      'Project' =&gt; array(
          'id' =&gt; '810',
          'created' =&gt; '2014-04-23',
          'project_number' =&gt; 'SPN00000810',
      )
  )
  </code></pre>
  
  <p>*Certain fields omitted for brevity.</p>
  
  <p>How do I loop through this array in the email template? I have tried the standard foreach loop as you would in the view, but then I get the undefined variable supplied foreach problem. Any advice or suggestions?</p>