title: October CMS Custom Mail Layout
body: <p>I'm struggling to get October CMS to work with custom mail layouts via code. Under <strong>Configuration section</strong> it states we can use <em>subject</em> and <em>layout</em>.</p>
  
  <p><a href="https://octobercms.com/docs/services/mail#mail-views" rel="nofollow">https://octobercms.com/docs/services/mail#mail-views</a></p>
  
  <p>I can see the subject is working as expected, however I'm struggling to get any form of layout coming out - its simply chucking out the HTML within the template.</p>
  
  <p>Here is the <em>register.htm</em> template file which is located within my plugins <em>views/mail</em> directory:</p>
  
  <pre><code>subject = "Registration"
  layout = "default"
  
  ==
  
  Dear {{name}},
  
  Thank you for registering you interest...
  
  Yours sincerely,
  
  Support
  
  ==
  
  &lt;p&gt;Dear {{name}},&lt;/p&gt;
  &lt;br&gt;
  &lt;p&gt;Thank you for registering you interest...&lt;/p&gt;
  &lt;br&gt;
  &lt;p&gt;Yours sincerely,&lt;/p&gt;
  &lt;br&gt;
  &lt;p&gt;Support&lt;/p&gt;
  </code></pre>
  
  <p>And I'm calling it like so:</p>
  
  <pre><code>Mail::send('pluginname::mail.register', $data, function($message) use ($data) {
      $message-&gt;to($data['email'], $data['name']);
  });
  </code></pre>