# |
Dec 27th 2019, 22:43 |
ashesh.social |
while calling `$this->getMailer('ContactUs')->send('contactUs', $entity);` getting the error ```Error: [TypeError] Argument 1 passed to Cake\Mailer\Message::validateEmail() must be of the type string, null given, called in /usr/local/cake-app/vendor/cakephp/cakephp/src/Mailer/Message.php``` |
# |
Dec 27th 2019, 22:41 |
ashesh.social |
working on the above process only @challgren |
# |
Dec 27th 2019, 21:50 |
challgren |
Second code block |
# |
Dec 27th 2019, 21:50 |
challgren |
https://book.cakephp.org/4/en/core-libraries/email.html#creating-reusable-emails |
# |
Dec 27th 2019, 21:49 |
challgren |
use MailerAwareTrait; then $this->getMailer(‘ContactUs’)->send(‘contactUs’, $entity); |
# |
Dec 27th 2019, 21:49 |
ashesh.social |
any code ? |
# |
Dec 27th 2019, 21:48 |
challgren |
in your controller add MailerAwareTrait |
# |
Dec 27th 2019, 21:48 |
ashesh.social |
@challgren how to use Mailer contactUs() method in controller |
# |
Dec 27th 2019, 20:53 |
wizardfix |
Thanks @dereuromark I'll have a good look at that. :) |
# |
Dec 27th 2019, 20:48 |
ashesh.social |
Seriously great job guys @challgren @narendravaghela :clap::skin-tone-3::clap::skin-tone-3: |
# |
Dec 27th 2019, 20:47 |
challgren |
But @narendravaghela did the heavy lifting with the transport |
# |
Dec 27th 2019, 20:47 |
challgren |
Ive pretty much taken it over since 3.7 |
# |
Dec 27th 2019, 20:46 |
ashesh.social |
Great going @challgren :clap::skin-tone-3::clap::skin-tone-3: |
# |
Dec 27th 2019, 20:46 |
ashesh.social |
Just checked that project in github and your contribution |
# |
Dec 27th 2019, 20:46 |
ashesh.social |
Yeahhhhh |
# |
Dec 27th 2019, 20:45 |
challgren |
I love this plug-in because it's so lightweight. Hence why I've contributed to it a lot and I use it on just about every project that needs to send mail |
# |
Dec 27th 2019, 20:41 |
ashesh.social |
Loving it<3 |
# |
Dec 27th 2019, 20:41 |
ashesh.social |
how cool these integrations are,:),:) |
# |
Dec 27th 2019, 20:40 |
challgren |
Doesnt require any other mailgun libs at all either |
# |
Dec 27th 2019, 20:40 |
ashesh.social |
Cool :raised_hands::skin-tone-3: |
# |
Dec 27th 2019, 20:39 |
challgren |
https://github.com/narendravaghela/cakephp-mailgun/blob/master/src/Mailer/MailgunTrait.php |
# |
Dec 27th 2019, 20:39 |
challgren |
`composer require narendravaghela/cakephp-mailgun "dev-master"` |
# |
Dec 27th 2019, 20:39 |
challgren |
Just the mailgun package |
# |
Dec 27th 2019, 20:39 |
ashesh.social |
So we need any packages for that ? |
# |
Dec 27th 2019, 20:38 |
ashesh.social |
How this will work |
# |
Dec 27th 2019, 20:38 |
ashesh.social |
```use Mailgun\Mailer\MailgunTrait;``` |
# |
Dec 27th 2019, 20:31 |
ashesh.social |
Very cool stuff ! |
# |
Dec 27th 2019, 20:28 |
challgren |
The MailgunTrait, MailgunMailer, and MailgunEmail just provide convenience for adding headers. The transport is what does the magic to send it via the HTTP API |
# |
Dec 27th 2019, 20:27 |
ashesh.social |
You making me more curious ,:) |
# |
Dec 27th 2019, 20:26 |
challgren |
? |
# |
Dec 27th 2019, 20:26 |
ashesh.social |
OMG |
# |
Dec 27th 2019, 20:25 |
challgren |
The docs for 4.x need a lot of work but the functions all work and the transport is the main beast behind everything |
# |
Dec 27th 2019, 20:24 |
ashesh.social |
yeah ok @challgren |
# |
Dec 27th 2019, 20:23 |
challgren |
You can use the MailgunTrait, MailgunMailer, or MailgunEmail |
# |
Dec 27th 2019, 20:22 |
challgren |
You can still use the old Email format but in CakePHP 5.x its going to be removed so the mailer is the best route |
# |
Dec 27th 2019, 20:21 |
ashesh.social |
Super great @challgren will check out |
# |
Dec 27th 2019, 20:21 |
challgren |
https://book.cakephp.org/4/en/core-libraries/email.html#creating-reusable-emails |
# |
Dec 27th 2019, 20:20 |
ashesh.social |
Where I need to use the above code you sent |
# |
Dec 27th 2019, 20:20 |
challgren |
What do you mean? |
# |
Dec 27th 2019, 20:20 |
ashesh.social |
So where will the code be present |
# |
Dec 27th 2019, 20:20 |
challgren |
Same config as 3.x |