CodeIgniter Forums
Email Class Not Working - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Email Class Not Working (/showthread.php?tid=54429)



Email Class Not Working - El Forum - 09-08-2012

[eluser]hema[/eluser]
Hi All,

I am having issues when sending mail through Email Class, below is the code i am using. Mail is going if attach() is not used. If attach() is used then it is going to failure case

Code:
function create()
{
    
$this->load->library('email');
$date = date('d-m-y');
$this->load->helper('to_pdf');

pdf_create( $this->load->view( 'html.php', '', true ), $date );

$this->email->from('[email protected]', 'Website');
$this->email->to('[email protected]');

$this->email->subject('Today Report');
$this->email->message('Please check your daily report for today');
$this->email->attach("/home/website/CI/pdf/todayreport.pdf");  // this url is fine because i am uploading through this path and works fine and pdf is also there in that pdf folder
if($this->email->send())
{

echo "it is working fine";

}
else
{

echo "failure";

}


  
}

Can anyone tell me if i am doing anything wrong. My attachments are only PDF files. Attach() is giving me error.


Email Class Not Working - El Forum - 09-08-2012

[eluser]solid9[/eluser]
The CodeIgniter Class I guess is incomplete.

I used PHPMailer class for email.