![]() |
Email Template - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Email Template (/showthread.php?tid=78561) |
Email Template - Gehasi - 02-07-2021 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 RE: Email Template - iRedds - 02-08-2021 I do not know what result you wanted to get using the CI3 code in CI4. It's time to read the documentation RE: Email Template - captain-sensible - 02-08-2021 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; RE: Email Template - buhosk - 03-29-2021 (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> RE: Email Template - InsiteFX - 03-30-2021 You can still do it but you have to use the view render. PHP Code: public function sendEmail() Just an example. |