开发者

sendind emil in codeigniter to multiple emailids

function send_letter()
{
    echo $description =  $this->input-开发者_Python百科>post('description',true);
    $this->load->model('newsletter_model');
    $this->data['mail_list'] = $this->newsletter_model->getmaillist();
    foreach()
    {
        $list = array('', '', '');
        $this->email->to($list);
    }
}

function getmaillist()
{

    $mail_list=array();
    $query=$this->db->get($this->_table);
    if($query->num_rows()>0)
    {
        foreach($query->result() as $row)
        {
            $mail_list[$row->user_id]['emailid']=$row->email_address;
        }
    }
    return $mail_list;
}

How can i get these email lists in foreach? I don't know how to write in foreach


I'm not sure I understand. You can add a comma separated list of people and email it to them.

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

http://codeigniter.com/user_guide/libraries/email.html

There is no need for a foreach loop.

$list = array('one@example.com', 'two@example.com', 'three@example.com');

$this->email->to($list); 

EDIT:

Change your foreach statement to the following and see if that helps:

foreach($query->result() as $row)
{
    array_push($mail_list, $row->email_address);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜