用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'] = '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我发现了一个错误: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 回答
![?](http://img1.sycdn.imooc.com/54584f8f00019fc002200220-100-100.jpg)
胡子哥哥
TA贡献1825条经验 获得超6个赞
php.ini
;extension=php_openssl.dll
extension=php_openssl.dll
- 3 回答
- 0 关注
- 2157 浏览
添加回答
举报
0/150
提交
取消