下面是个简单的例子,用于演示如何发送邮件。注意:这个例子假设你是在某个Controllers 里面发送邮件。
public function __construct()
{
//引用email类
$this->load->library('email');
}
public function sendmail(){
$this->email->from('your@example.com', 'Your Name'); $this->email->to('someone@example.com'); $this->email->cc('another@another-example.com'); $this->email->bcc('them@their-example.com'); $this->email->subject('Email Title'); $this->email->message('Test Mail Content.'); $this->email->send();
}
//在CI_Email类里面配置参数
class CI_Email {
/**
* Used as the User-Agent and X-Mailer headers' value.
*