gmail smtp 无法在我的主机中使用 codeigniter 框架工作
我希望使用gmail smtp将用户信息发送到注册的电子邮件中。
我正在使用的代码在我的本地主机中运行良好,但是当我更改为共享托管时,会出现以下错误。
A PHP Error was encountered
Severity: Warning
Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.googlemail.com:465 (Connection timed out)
Filename: libraries/Email.php
Line Number: 1652
A PHP Error was encountered
Severity: Warning
Message: fwrite(): supplied argument is not a valid stream resource
Filename: libraries/Email.php
Line Number: 1795
.... (more error msg here)
An Error Was Encountered
The following SMTP error was encountered: 110 Connection timed out
Unable to send data: AUTH LOGIN
Failed to send AUTH LOGIN command. Error:
Unable to send data: MAIL FROM:
from:
The following SMTP error was encountered:
Unable to send data: RCPT TO:
to:
The following SMTP error was encountered:
Unable to send data: DATA
.... (more error msg here)
这是我的电子邮件配置
$pass = $this->generatePassword('6'); $配置=数组( '协议' => 'smtp', 'smtp_host' =>; 'ssl://smtp.googlemail.com', 'smtp_端口' => 465、 'smtp_timeout'=>'30', 'smtp_user'=>; '[电子邮件受保护]', 'smtp_pass' =>; '我的密码', '邮件类型' => 'html', '字符集' => 'iso-8859-1' ); $this->load->library('email', $config); $this->电子邮件->set_newline("\r\n"); $this->email->from('[电子邮件受保护] ','标题'); $this->email->to($this->input->post('email')); $this->电子邮件->主题('此处主题'); $this->email->message('您的登录用户名是 '.$this->input->post('用户名').'
'.'密码是 '.$pass ); if (!$this->电子邮件->send()){ show_error($this->电子邮件->print_debugger()); }其他{回显'是的!!!';}
我尝试检查我的共享托管 openssl 是否已启用。我发现了这个
openssl 已启用 OpenSSL 支持
OpenSSL 版本 OpenSSL 0.9.8e-fips-rhel5 2008 年 7 月 1 日
如果 openssl 已启用。我的代码中仍然会出现什么错误?
我开始对使用本地主机进行开发感到沮丧,当它上传到共享托管时,它出现了很多错误。
任何帮助将不胜感激!谢谢提前
i wish to use gmail smtp to send user information to the registered email.
The code that i am using is working fine in my localhost, but when i changed into shared hosting it come out with the below error.
A PHP Error was encountered
Severity: Warning
Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.googlemail.com:465 (Connection timed out)
Filename: libraries/Email.php
Line Number: 1652
A PHP Error was encountered
Severity: Warning
Message: fwrite(): supplied argument is not a valid stream resource
Filename: libraries/Email.php
Line Number: 1795
.... (more error msg here)
An Error Was Encountered
The following SMTP error was encountered: 110 Connection timed out
Unable to send data: AUTH LOGIN
Failed to send AUTH LOGIN command. Error:
Unable to send data: MAIL FROM:
from:
The following SMTP error was encountered:
Unable to send data: RCPT TO:
to:
The following SMTP error was encountered:
Unable to send data: DATA
.... (more error msg here)
Here's my email config
$pass = $this->generatePassword('6'); $config = Array( 'protocol' => 'smtp', 'smtp_host' => 'ssl://smtp.googlemail.com', 'smtp_port' => 465, 'smtp_timeout'=>'30', 'smtp_user' => '[email protected]', 'smtp_pass' => 'mypassword', 'mailtype' => 'html', 'charset' => 'iso-8859-1' ); $this->load->library('email', $config); $this->email->set_newline("\r\n"); $this->email->from('[email protected]','Title'); $this->email->to($this->input->post('email')); $this->email->subject('Subject here'); $this->email->message('Your login username is '.$this->input->post('username').'<br/>'.'Password is '.$pass); if (!$this->email->send()){ show_error($this->email->print_debugger()); }else{ echo 'YEAH!!!';}
i try to check my share hosting openssl whether is enabled or not. and i found this
openssl
OpenSSL support enabled
OpenSSL Version OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
If openssl is enabled. still what will be the mistake in my code?
I start to be frustrated to use my localhost to develop and when its uploaded to share hosting, it came out wit lots of error.
Any help would be appreciate!! thx in advanced
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来共享主机中的 ssl 端口很接近,
使用此代码检查它是否打开。
Looks like ur ssl port in shared hosting is close,
use this code to check if it is open.
较新的 php 中的测试脚本有更新
版本:
there is update for test script in newer php
version: