我需要使用CI向cc提供的多个用户发送电子邮件。 我的代码如下所示: 以下代码适用于为单个用户发送电子邮件,但我需要同时向多个用户发送相同的消息..
$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();
答案 0 :(得分:14)
尝试在$ this-> email->这样的cc函数中使用分开的电子邮件。
$this->email->cc('email1@test.com,email2@test.com,email3@test.com');
您也可以像这样使用
$this->email->to('one@example.com, two@example.com, three@example.com');
有关电子邮件参考的信息,请点击Here
链接答案 1 :(得分:1)
尝试使用数组,向多个用户发送电子邮件..
$this->email->to($list);
$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();