Codeigniter电子邮件cc和密件抄送不起作用

时间:2017-04-28 11:03:35

标签: php codeigniter email

我正在使用codeigniter的电子邮件库。此代码正确地将邮件发送到$to变量,但不是$cc$bcc。如果有人可以的话,请帮助我!

$this->load->library('email');
$this->email->from($from);
$this->email->bcc($bcc);
$this->email->cc($cc);
$this->email->to($to);
$this->email->subject($subject);
$this->email->message($content);
$this->email->send();

2 个答案:

答案 0 :(得分:0)

你错了代码,在BCC上使用一个数组。

$this->email->bcc(array($this->input->post('bcc_email')));

答案 1 :(得分:-1)

使用此库:

$this->load->library('email');

然后使用此代码,它在我身边工作:

$this->email->from('your@example.com', $this->input->post('fullname'));
$this->email->to($this->input->post('email'));
$this->email->cc($this->input->post('cc_email'));
$this->email->bcc($this->input->post('bcc_email'));
$this->email->subject('Registeration Notification');
$this->email->message('You have registered successfully.\nYour username is :'.$this->input->post('email'));

$this->email->send();