How To Ship Electronic Mail To Multiple Recipients Alongside Attachments Using Codeigniter ?
Sending e-mail is real elementary inward Codeigniter. The next slice of code volition e-mail amongst attachments to all recipients at once. It volition preclude showing all recipients address inward email, too volition e-mail it separately for each recipient.
Here $list contains array of Recipient advert too e-mail ID. Make certain to purpose clear(TRUE) at the commencement of each iteration.
Example used higher upwards is taken from http://ellislab.com/codeigniter/user-guide/libraries/email.html. Sumber http://developer-paradize.blogspot.com
//loading necessary helper classes $this->load->library('email'); $this->load->helper('path'); $this->load->helper('directory'); //setting path to attach files $path = set_realpath('assets/your_folder/'); $file_names = directory_map($path); foreach ($list every mo $name => $address) { //if yous prepare the parameter to TRUE whatever attachments volition hold upwards cleared likewise $this->email->clear(TRUE); $this->email->to($address); $this->email->from('your@example.com'); $this->email->subject('Here is your information '.$name); $this->email->message('Hi '.$name.' Here is the information yous requested.'); foreach($file_names every mo $file_name) { $this->email->attach($path.$file_name); } $this->email->send(); }
Here $list contains array of Recipient advert too e-mail ID. Make certain to purpose clear(TRUE) at the commencement of each iteration.
Example used higher upwards is taken from http://ellislab.com/codeigniter/user-guide/libraries/email.html. Sumber http://developer-paradize.blogspot.com
Comments
Post a Comment