用Gmail SMTP發(fā)送電子郵件和代碼點火器電子郵件庫<?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'] = 'mygmail@gmail.com';
$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('mygmail@gmail.com', 'myname');
$this->email->to('target@gmail.com');
$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我發(fā)現(xiàn)了一個錯誤: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我現(xiàn)在不想用phpmailer了。(實際上我曾嘗試使用phpmailer,但失敗了)。伙計們,我該怎么解決這個問題?
3 回答

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