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

**URL:** <https://discourse.cakephp.org/t/cakephp-3-11-email-vs-cakephp-4-4-mailer/10982>\
**Category:** Need Help\
**Created:** [February 24, 2023, 7:44pm UTC](https://discourse.cakephp.org/t/cakephp-3-11-email-vs-cakephp-4-4-mailer/10982 "2023-02-24T19:44:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![YesNo](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/yesno/32/334_2.png) [@YesNo](https://discourse.cakephp.org/u/YesNo)\
**Post date:** [February 24, 2023, 7:44pm UTC](https://discourse.cakephp.org/t/cakephp-3-11-email-vs-cakephp-4-4-mailer/10982/1 "2023-02-24T19:44:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [February 25, 2023, 3:55pm UTC](https://discourse.cakephp.org/t/cakephp-3-11-email-vs-cakephp-4-4-mailer/10982/2 "2023-02-25T15:55:44Z")

</div>

Is [this](https://book.cakephp.org/4/en/core-libraries/email.html#sending-messages-quickly) maybe what you’re looking for? Hard to tell, because you haven’t really included enough details to understand your use case.

---

<div class="post-metadata">

**Author:** ![YesNo](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/yesno/32/334_2.png) [@YesNo](https://discourse.cakephp.org/u/YesNo)\
**Post date:** [February 25, 2023, 7:09pm UTC](https://discourse.cakephp.org/t/cakephp-3-11-email-vs-cakephp-4-4-mailer/10982/3 "2023-02-25T19:09:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Zuluru](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/zuluru/32/1230_2.png) [@Zuluru](https://discourse.cakephp.org/u/Zuluru)\
**Post date:** [February 25, 2023, 8:09pm UTC](https://discourse.cakephp.org/t/cakephp-3-11-email-vs-cakephp-4-4-mailer/10982/4 "2023-02-25T20:09:02Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![YesNo](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/yesno/32/334_2.png) [@YesNo](https://discourse.cakephp.org/u/YesNo)\
**Post date:** [February 26, 2023, 1:54pm UTC](https://discourse.cakephp.org/t/cakephp-3-11-email-vs-cakephp-4-4-mailer/10982/5 "2023-02-26T13:54:28Z")

</div>

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);
