10/10/2018, 11:21
Cần giúp đỡ về CodeIgniter
Mình gặp vấn đề về Send Mail bằng Gmail
Và lỗi gặp phải là:
A PHP Error was encountered
Severity: Warning
Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.googlemail.com:465 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?)
Filename: libraries/Email.php
Line Number: 1673
///////////
A PHP Error was encountered
Severity: Warning
Message: fwrite(): supplied argument is not a valid stream resource
Filename: libraries/Email.php
Line Number: 1816
Mình send mail từ localhost và mình đang xài phiên bản Version 2.0.2
Mong các bạn chỉ giáo giùm. Cảm ơn rất nhiều
Code:
$config = Array( 'protocol' => 'smtp', 'smtp_host' => 'ssl://smtp.googlemail.com', 'smtp_port' => 465, 'smtp_user' => 'ngocthang.ictu@gmail.com', 'smtp_pass' => 'password', ); $this->load->library('email', $config); $this->email->set_newline(" "); $this->email->from('ngocthang.ictu@gmail.com', 'Mr. Test'); $this->email->to('ngocthang.ictu@gmail.com'); $this->email->subject(' My mail through codeigniter from localhost '); $this->email->message('Hello World…'); if (!$this->email->send()) show_error($this->email->print_debugger()); else echo 'Your e-mail has been sent!';
A PHP Error was encountered
Severity: Warning
Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.googlemail.com:465 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?)
Filename: libraries/Email.php
Line Number: 1673
///////////
A PHP Error was encountered
Severity: Warning
Message: fwrite(): supplied argument is not a valid stream resource
Filename: libraries/Email.php
Line Number: 1816
Mình send mail từ localhost và mình đang xài phiên bản Version 2.0.2
Mong các bạn chỉ giáo giùm. Cảm ơn rất nhiều
Bài liên quan
LoadModule ssl_module modules/mod_ssl.so
bỏ # ở trước là được.
Khởi động lại apache và chạy lại thử được ko
;extension=php_openssl.dll
đây là đoạn config của mình trong file email.php của thư mục config :
Mà chủ topic cho hỏi sao phải send mail = ssl vậy nhỉ ? Thấy lạ lạ thường tui gửi smtp ko nhưng bác gửi sao lại có ssl vậy ?
[=========> Bổ sung bài viết <=========]