Ad
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.
https://octobercms.com/docs/services/mail#mail-views
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,
Support
==
<p>Dear {{name}},</p>
<br>
<p>Thank you for registering you interest...</p>
<br>
<p>Yours sincerely,</p>
<br>
<p>Support</p>
And I'm calling it like so:
Mail::send('pluginname::mail.register', $data, function($message) use ($data) {
$message->to($data['email'], $data['name']);
});
Ad
Answer
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.'
];
}
Ad
source: stackoverflow.com
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
Ad