Bladephp: Now with 7+ codeigniter, php, and laravel project 7+ php project From $18/Year From Rs. 1000/Year

How to send email with an attachment using Codeigniter

by
Category:codeigniter
codeigniter
How to send email with an attachment using Codeigniter

In this tutorial, we’ll show the mostly used email features for the web project. Using our sample code you can send a text email, HTML email, and email with an attachment.

Code

$this->load->library('email');

$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$config['mailtype'] = 'html';
$this->email->initialize($config);

$this->email->to("demo@gmail.com");
$this->email->from("from@gmail.com");
$this->email->subject("Test");
$this->email->message("Type Your Message");
$this->email->attach(base_url().'/assets/pdf_invoice/'.$pdfname.'');
$this->email->send();

0 Comments


Html code work in comment box


Related Post