How To Send Email In Codeigniter



Hello friends ajj me apko btaunga ki ham codeigniter framework me kis trah se email send kar sakte hai easily.

Yanha sabse pehle ham email library ko load karwayege jiski madad se ham codeigniter me email send kar payege
Send text mail-
$this->load->library('email');
$this->email->to('recipient@example.com');
$this->email->from('yourmail@gmail.com','formname');
$this->email->subject('Test Email (TEXT)');
$this->email->message('Text email testing .');
$this->email->send();


Send  mail to multiple recipient-
$this->email->to('first@example.com, second@example.com, three@example.com');

Send html mail-
$htmlContent 'HTML email testing';

$htmlContent .= 'enter content in this email';

    

$config['mailtype'] = 'html';

$this->email->initialize($config);

$this->email->to('recipient@gmail.com');

$this->email->from('yourmail@gmail.com','formname’);

$this->email->subject('Test Email (HTML)');

$this->email->message($htmlContent);

$this->email->send();

Send email with attachment-
$this->email->attach('files/attachmentfiles.pdf');
Yanha ham attachment sned karne ke liye sirf upper diye code me  $this->email->message($htmlContent); ke just niche is code ko paste karke attachment send kar sakte hai easily

Thank You
Team Gajabwap Web In Hindi

Previous
Next Post »
Thanks for your comment