发邮件问题
class Test extends Controller{
function __construct()
{
parent::__construct();
$this->load->library('email');
}
function index()
{
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.gmail.com';
$config['smtp_user'] = 'eric.chang.zmm@gmail.com';
$config['smtp_pass'] = 'ericchangzmm';
$config['smtp_port'] = '465';
$config['smtp_timeout'] = '5';
$config['newline'] = "\r\n";
$config['crlf'] = "\r\n";
$this->email->initialize($config);
$this->email->from('eric.chang.zmm@gmail.com', 'eric');
$this->email->to('zmm_eric@126.com');
$this->email->subject('subject');
$this->email->message('this is the mail content');
$this->email->send();
}
}
发送时出现这样的错误 请问大侠什么问题?????
A PHP Error was encountered
Severity: Warning
Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.gmail.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: 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
请检查你的PHP环境所对应的 php.ini 文件,确定其中启用了ssl扩展。
extension=php_openssl.dll
默认情况下这一行前面有个分号,请把它去掉,再重启你的Apache或者IIS。 楼上说的没错。
错误信息已经说的很明确了。 我打开了
extension=php_openssl.dll
但还是抱这个错 你确定在PHP的扩展目录下存在 php_openssl.dll 这个文件么? 恩 看了D:\AppServ\php5\ex\php_openssl.dll 本帖最后由 yinzhili 于 2009-11-23 15:30 编辑
那就奇怪了,看看你的Apache日志里面有些什么。(Apache所在目录的 logs\error.log 文件中)
或者,把PHP目录下的libeay32.dll和ssleay32.dll这两个文件复制到Windows\system32下面,重启Apache。 不推荐用 ssl 发邮件吧,不适用所有服务器。
qq 的 smtp 很好用。 我在英文论坛问过这样的问题
http://codeigniter.com/forums/viewthread/134172/
你换下163的吧
页:
[1]