Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send multiple email with cc using Codeigniter?

I need to send email to multiple users provided with cc using CI. My code is as shown below: This below code worked for sending email for single user but i need to send same message to multiple user at a same time..

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

                $to = 'User email address here';
                $subject = 'Alert information On Products';
                $message = "Dear user,Our new product has been launched.Please visit our site for more informations";                 
                $this->load->library('email');
                // from address
                $this->email->from('admin_email_address');
                $this->email->to($to); // to Email address
                $this->email->cc('email_address_one'); 
                $this->email->subject($subject); // email Subject
                $this->email->message($message);
                $this->email->send();
like image 689
Susanne Avatar asked Mar 11 '15 06:03

Susanne


2 Answers

try to use , seperated email in $this->email->cc function like this .

 $this->email->cc('[email protected],[email protected],[email protected]');

you can also use like this

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

for email reference follow the link Here

like image 99
Manoj Dhiman Avatar answered Sep 30 '22 11:09

Manoj Dhiman


try to use an array, to send email to multiple users...

$list = array('[email protected]', '[email protected]', '[email protected]');
$this->email->to($list);
$this->email->subject('This is my subject');
$this->email->message('This is my message');
$this->email->send();
like image 35
vinodh_dizzy Avatar answered Sep 30 '22 12:09

vinodh_dizzy