I am new to codeignitor, i try to send HTML content in email, but received mail contains the source code as below what exactly in view page. How to solve this problem?
<html>
<body>
<form name=“email_form” method=“post”>
<b>This is test mail from Codeignitor with attachment and html format, please ignore it..<b>
</form>
</body>
</html>
Below is my controller code
<?php
class Send_mail extends Controller
{
function Send_mail()
{
parent::Controller();
$this->load->library("email");
}
function index()
{
$this->email->from("[email protected]","Shankar Ganesh.N");
$this->email->to("[email protected]");
$this->email->subject("Test mail from codeignitor");
$mesg=$this->load->view('emails',"",true);
$this->email->message($mesg);
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$this->load->library('email', $config);
$data['message']=$this->email->send()?'Message was sent successfully!':'Error sending email!';
echo "<br><br><br>";
echo $this->email->print_debugger();
}
}
?>
Below is my view code
<html>
<body>
<form name=“email_form” method=“post”>
<b>This is test mail from Codeignitor with attachment and html format, please ignore it..<b>
</form>
</body>
</html>