CodeIgniter Forums
How to send an email with content from a View Ci4 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forumdisplay.php?fid=29)
+--- Thread: How to send an email with content from a View Ci4 (/showthread.php?tid=80193)



How to send an email with content from a View Ci4 - naldi - 09-26-2021

When I use Ci3, I can use the script for send email with content from view like this :
Code:
$msg = $this->load->view('register/V_reset_password', $data, true);
$this->email->message($msg);

But in Ci4 that script cannot be used. I have to try like this and getting error :
Code:
$message = view('register/V_reset_password', $data, true);
$email->setMessage($message);
Please help to tell me what is a new code for send an email with content from view Ci4 ?
Thank you..




RE: How to send an email with content from a View Ci4 - kenjis - 09-27-2021

The code seems no problem.
What error message do you get?


RE: How to send an email with content from a View Ci4 - davis.lasis - 09-27-2021

Read this documentation, if the issue still is not resolved, then send in error message
https://codeigniter4.github.io/CodeIgniter4/libraries/email.html


RE: How to send an email with content from a View Ci4 - naldi - 09-27-2021

(09-27-2021, 12:58 AM)kenjis Wrote: The code seems no problem.
What error message do you get?

This is error message :
view(): Argument #3 ($options) must be of type array, bool given, called in


RE: How to send an email with content from a View Ci4 - naldi - 09-27-2021

(09-27-2021, 03:57 AM)davis.lasis Wrote: Read this documentation, if the issue still is not resolved, then send in error message
https://codeigniter4.github.io/CodeIgniter4/libraries/email.html

I have read it. But I cannot find how to send an email with content from a view file.


RE: How to send an email with content from a View Ci4 - InsiteFX - 09-28-2021

PHP Code:
$body view('yourView'$data);

$email->setMessage($body); 



RE: How to send an email with content from a View Ci4 - naldi - 09-28-2021

(09-28-2021, 01:56 AM)InsiteFX Wrote:
PHP Code:
$body view('yourView'$data);

$email->setMessage($body); 
Thank you,
I have solved it before with only remove true... Shy