//有谁知道我是如何解决这个问题的。我已经在 php.ini 上取消了必要的文件的注释但无济于事我仍然得到错误,我使用 xampp 作为我的本地主机。
//emails.php
function email(){
$this->load->model('user');
$emails=$this->user->get_emails();
$this->load->library('email');
$config['mailtype']='html';
$this->email->initialize($config);
foreach($emails as $row){
$email_config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => '465',
'smtp_user' => 'dirk@gmail.com',
'smtp_pass' => 'dirk',
'mailtype' => 'html',
'starttls' => true,
'newline' => "\r\n"
);
$this->load->library('email', $email_config);
if($row['email']){
$this->email->from('dirk@gmail.com', 'dirk');
$this->email->to($row['email']);
$this->email->subject('Test Newsletter');
$this->email->message('Your email message goes here! <strong>Bold</strong>');
$this->email->send();
$this->email->clear();
}
}
}
//user.php
function get_emails(){
$this->db->select('email')->from('users');
$query = $this->db->get();
return $query->result_array();
}