I'm using cakephp 3.1.6 and I have an admin prefix to separate my administration section. Using this approach I've generated this folder structure for templates:
src/Template
├── Admin
│ ├── Element
│ │ └── ...
│ ├── Email
│ │ └── ...
│ ├── Layout
│ │ └── ...
│ └── ...
├── Element
│ └── ...
├── Email
│ └── ...
├── Layout
│ └── ...
└── ...
It works for normal templates, but it isn't working for email templates. Cakephp is trying to find email templates on default location i.e. src/Template/Email
I've tried using viewBuilder
to set the path, like this:
$email = new Email('default');
$email->viewBuilder()->layoutPath(APP . "Template" . DS . "Admin")
->templatePath(APP . "Template" . DS . "Admin")
->build();
$email->template('forgot_password', 'default')
->to($user->email, $user->nick_name)
->subject('Reset password')
->send();
But it still fails.
Is there any way to change the path for email templates?