我知道这是一个非常常见的问题,但我无法找到问题的正确答案。
我使用codeigniter和xampp以及这个名为miniRelay的电子邮件服务器。
我的配置是:
的php.ini
extension=php_openssl.dll
[mail function]
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
SMTP = 127.0.0.1
smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
; sendmail_from = postmaster@localhost
(我有一个32位的Windows 7专业版)
我的控制器中:
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.gmail.com',
// 'smtp_port' => 465,
'smtp_port' => 25,
'smtp_user' => 'mymail@gmail.com',
'smtp_pass' => 'mypass',
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from(anothermail@gmail.com, "from contact form");
$this->email->to("mymail@gmail.com");
// $this->email->cc("testcc@domainname.com");
$this->email->subject("This is test subject line");
$this->email->message("Mail sent test message...");
$data['message'] = "Sorry Unable to send email...";
if($this->email->send()){
$data['message'] = "Mail sent...";
}
然后,我所做的就是打开minirelay服务器......它说正在侦听端口25 ......但是在发送测试电子邮件时没有显示任何活动。
我得到的错误是:
fsockopen(): SSL operation failed with code 1. OpenSSL Error messages: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
fsockopen(): Failed to enable crypto
fsockopen(): unable to connect to ssl://smtp.gmail.com:25 (Unknown error)
我真的不喜欢协议,而且我很难过......我想要一些指导......