我看过很多帖子涉及到这个问题,我已经做了给出的指令,但总是得到同样的错误..
我想用代码点火器2.1.3发送SMTP的Gmail,这是代码:
class Email extends CI_Controller{
function index(){
$config = Array(
'protocol' => 'smtp',
'smtp_crypto' => 'ssl',
'smtp_host' => 'smtp.gmail.com',
'smtp_user' => 'myEmail@gmail.com',
'smtp_pass' => '***********',
'smtp_port' => 25,
'mailtype' => 'text',
'smtp_timeout' => 15,
'charset' => 'iso-8859-1'
);
$this->load->library('email', $config);
$this->email->set_crlf("\r\n");
$this->email->set_newline("\r\n");
$this->email->from("myEmail@gmail.com", "myName");
$this->email->to("myEmail@gmail.com");
$this->email->subject("Email Test");
$this->email->message("This is email test");
if($this->email->send()){
echo 'Email Send';
} else{
show_error($this->email->print_debugger());
}
}
而错误总是这样,
Message: fsockopen(): unable to connect to ssl://smtp.gmail.com:25 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. )
请帮我解决这个错误,谢谢:)