How to send multiple email with cc using Codeigniter?
Asked Answered
T

2

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();
Tyro answered 11/3, 2015 at 6:47 Comment(0)
C
15

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

Craiova answered 11/3, 2015 at 7:18 Comment(0)
I
1

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();
Indigestive answered 3/2, 2016 at 7:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.