I am having an error Message: Undefined variable: posts
. This is what I received after I sent an email using Codeigniter
email.
I need to send an html
output through CI
email.
Controller:
function email() {
$this->load->library('email');
$config = array (
'mailtype' => 'html',
'wordwrap'=> TRUE,
'charset' => 'utf-8',
'priority' => '1'
);
$this->email->initialize($config);
$this->email->from('mywebsite.com', 'My website');
$this->email->to('sender@gmail.com');
$this->email->subject('Test');
$data = $this->data['posts'] = $this->paypal->getRows();
$message = $this->load->view('Receipt', '$data', true);
$this->email->message($message);
$this->email->send();
}
View Receipt.php
(this is the view I want to send in an email)
foreach ($posts as $row) {
$row->room_type;
}