用Gmail SMTP發送電子郵件和代碼點火器電子郵件庫<?phpclass Email extends Controller {
function Email()
{
parent::Controller();
$this->load->library('email');
}
function index()
{
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.gmail.com';
$config['smtp_port'] = '465';
$config['smtp_timeout'] = '7';
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = '*******';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$config['mailtype'] = 'text'; // or html
$config['validation'] = TRUE; // bool whether to validate email or not
$this->email->initialize($config);
$this->email->from('[email protected]', 'myname');
$this->email->to('[email protected]');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
echo $this->email->print_debugger();
$this->load->view('email_view');
}}我得到了這個錯誤:A PHP Error was encounteredSeverity: WarningMessage: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.gmail.com:465 (Connection timed out)Filename: libraries/Email.phpLine Number: 1641使用PORT 25/587我發現了一個錯誤:A PHP Error was encounteredSeverity: WarningMessage: fsockopen() [function.fsockopen]: SSL operation failed with code 1. OpenSSL Error messages: error:140770FC:SSL routines:func(119):reason(252)Filename: libraries/Email.phpLine Number: 1641我現在不想用phpmailer了。(實際上我曾嘗試使用phpmailer,但失敗了)?;镉媯?,我該怎么解決這個問題?
3 回答

胡子哥哥
TA貢獻1825條經驗 獲得超6個贊
php.ini
;extension=php_openssl.dll
extension=php_openssl.dll
- 3 回答
- 0 關注
- 2172 瀏覽
添加回答
舉報
0/150
提交
取消