我已经配置了php.ini,sendmail.ini并且还为gmail使用了正确的端口和配置,我还在gmail上启用了不太安全的应用程序,但是当我检查收件箱并且没有显示错误时我可以看到邮件
这是控制器
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
// SMTP Port - the port that you is required
$config['smtp_port'] = 465;
$config['smtp_user'] = $sender_email;
$config['smtp_pass'] = $sender_password;
$this->load->library('email', $config);
$this->email->from($sender_email);
$this->email->to($to_email);
$this->email->subject($subject);
$this->email->message($message);
if(!$this->email->send()) {
show_error($this->email->print_debugger());
}
else{
echo 'Your email has been sent!<br/>';
}
echo $message2; //send this in email
的php.ini
extension=php_openssl.dll
sendmail.ini
smtp_server=smtp.gmail.com
smtp_port=465
auth_username= xxxx.gmail.com
auth_password= xxxx