Cakephp 3.11 Email() vs. cakephp 4.4 Mailer()

Hello.

Cake\Mailer\Email is deprecated so I change to the new Cake\Mailer\Mailer. But in my case I have ready maid content which I have send like

$email = new Email();
.
.
.
$email->send(html content as string),

How to do this with Cake\Mailer\Mailer ?

Thanks a lot for a help

Michael

Is this maybe what you’re looking for? Hard to tell, because you haven’t really included enough details to understand your use case.

Yes. I understand.
My email layout with text and html will be created be an editor. And will be stored in a json database cell. then it will be loaded as $html and then:
As I explained above:
$email = new Email();
.
.something more
.
$email->send(html content as string),

No this does not work with Cake\Mailer\Mailer
$email = new Mailer()
but how to send html template as content to my email instance?

Michael

Did you read the whole “Sending Messages Quickly” section that I linked to above? What do you need to do that it’s not capable of?

Hello Zuluru.

Thank you for reminding me to read. The magic word is. ->deliver($content)
instead of ->send().

I can do this:

$email = new Mailer();
$email->setEmailFormat(‘html’);
$email->setTo($to);
$email->addBcc($email);
$email->viewBuilder()->setTemplate(‘template’);
$email->deliver($emailContent);