Problem template mailer

hy!!!

I am trying to send an email with a template. but every time I try to include a template, the email crashes.
Without the template, the email is sent and received.
I use the viewBuilder and its setTemplate and setLayout object.
I’m the doc but it still doesn’t work. I can’t understand or I’m wrong.

if someone could help me understand where my error is. Thanks for your help.

I’m not knowledgeable about that system but I wonder if the DebugKit can help you. It may show error output?

https://book.cakephp.org/debugkit/4/en/index.html#using-the-mail-panel

Or check your error log. There will be details somewhere. Have you tried it with a blank template (or just a bit of text, no PHP code)? If that works, then it’s a bug in your template code.