October CMS Custom Mail Layout

I'm struggling to get October CMS to work with custom mail layouts via code. Under Configuration section it states we can use subject and layout.


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.

Here is the register.htm template file which is located within my plugins views/mail directory:

subject = "Registration"
layout = "default"


Dear {{name}},

Thank you for registering you interest...

Yours sincerely,



<p>Dear {{name}},</p>
<p>Thank you for registering you interest...</p>
<p>Yours sincerely,</p>

And I'm calling it like so:

Mail::send('pluginname::mail.register', $data, function($message) use ($data) {
    $message->to($data['email'], $data['name']);


Make sure you have registered the mail template in the Plugin.php file so it can be bound to the layout.

public function registerMailTemplates()
    return [
        'pluginname::mail.register'  => 'Register template.'
source: stackoverflow.com
js interview questions