【问题标题】:How to send multiple email with cc using Codeigniter?如何使用 Codeigniter 通过 cc 发送多封电子邮件?
【发布时间】:2015-05-12 20:45:15
【问题描述】:

我需要使用 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();

【问题讨论】:

    标签: codeigniter mailer


    【解决方案1】:

    尝试在 $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

    【讨论】:

      【解决方案2】:

      尝试使用数组,向多个用户发送电子邮件...

      $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();
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-09-07
        相关资源
        最近更新 更多