7

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();
Susanne
  • 73
  • 1
  • 1
  • 4

2 Answers2

15

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

 $this->email->cc('email1@test.com,email2@test.com,email3@test.com');

you can also use like this

$this->email->to('one@example.com, two@example.com, three@example.com');

for email reference follow the link Here

Manoj Dhiman
  • 5,096
  • 6
  • 29
  • 68
1

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

$list = array('one@example.com', 'two@example.com', 'three@example.com');
$this->email->to($list);
$this->email->subject('This is my subject');
$this->email->message('This is my message');
$this->email->send();
Tayyab Hayat
  • 815
  • 1
  • 9
  • 22