我正在按照教程使用 gmail 发送电子邮件,但是我得到的是一个页面,它只是挂起,甚至没有加载错误。我正在使用 MAMP,所以这可能是它不起作用的原因。
class Email extends CI_Controller{
public function __construct()
{
parent::__construct();
}
function index(){
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'email',
'smtp_pass' => 'pass'
);
$this->load->library('email',$config);
$this->email->set_newline("/r/n");
$this->email->from('email', 'George');
$this->email->to('email');
$this->email->subject('hey this is an email');
$this->email->message('this is the content of the email');
if($this->email->send()){
echo 'Your message was sent';
}else{
show_error($this->email->print_debugger());
}
}
}