article

Monday, March 24, 2014

How To Send Email With An Attachment In Codeigniter?

How To Send Email With An Attachment In Codeigniter?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$this->load->library('email');
$this->load->helper('path');
 
$this->email->from('your@example.com', 'Your Name');
$this->email->to('someone@example.com');
$this->email->cc('another@another-example.com');
$this->email->bcc('them@their-example.com');
 
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
 
/* This function will return a server path without symbolic links or relative directory structures. */
$path = set_realpath('uploads/pdf/');
$this->email->attach($path . 'yourfile.pdf');  /* Enables you to send an attachment */
 
 
$this->email->send();
 
echo $this->email->print_debugger();

Related Post