Email Template |
Hey Guys,
I'm relativly new in CI4 and im having problem with my email sending. We have different emails we want to send from our website. Its working good the email are going out. But now we don't want to just send a email we want to have a template around the mail. So I created a emailhead.php in the app/view folder and also a emailbody.php in the same folder and I just want to load it into my controller before the actual message. I tried to do Code: $message = $this->load->view('emailhead.php'); But I allways get an error ErrorException Undefined property: App\Controllers\Email::$load I appriciate all of your help, thanks
I do not know what result you wanted to get using the CI3 code in CI4.
It's time to read the documentation
a simple approach perhaps might be to assign the content of your template, which can contain html syntax to a controller class member via heredoc
Code: <?php namespace App\Controllers; Code: $this->totalMessage= $this->headerTemplate." other string content".$this->headerFooter; send $totalMessage; (02-07-2021, 08:16 PM)Gehasi Wrote: Hey Guys, Hello, i have the same trouble in ci3 you can use $this->load->view('template.php'); but not in ci4 you can do it this PHP Code: $email = \Config\Services::email(); in parser you template use pseudo-variables Code: <html>
You can still do it but you have to use the view render.
PHP Code: public function sendEmail() Just an example. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |