我正在尝试使用 CI 创建一个电子邮件通知系统。问题是我正在使用的系统阻止了 gmail。所以,我无法使用 gmail SMTP。现在,我必须想办法用 hotmail 或任何其他 SMTP 服务发送电子邮件。 这是我的代码,适用于 gmail,但现在适用于 hotmail 配置/电子邮件.php:
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.live.com',
'smtp_port' => 587,
'smtp_user' => 'muttalebr@hotmail.com',
'smtp_pass' => 'XXXXXX',
'charset' => 'utf-8',
'newline' => "\r\n",
'crlf' => "\r\n",
'mailtype' => "html",
);
调用 email.php 并发送电子邮件的实际函数:
function sends($from,$to,$send,$user){
$link=base_url()."index.php/anonymouscoll/cmembersarea/".$user;
$emailmessage="Hello $to,<br />You have a new Gift from $from.<br />Click on the link:<a href=$link>$link</a> to check your gift.<br /><br /><br />Best Regards<br />Online Communication.";
$this->load->library('email');
$this->email->from('muttalebr@hotmail.com','Gift File');
$this->email->to($send);
$this->email->subject('You have a new Gift');
$this->email->message($emailmessage);
if($this->email->send()){
echo "Email sent";
}
else{
show_error($this->email->print_debugger());
}
每次我调用“发送”函数时,我都会收到以下错误:
Severity: Warning
Message: fsockopen() [function.fsockopen]: SSL operation failed with code 1. OpenSSL Error messages: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
Filename: libraries/Email.php
Line Number: 1673
and
Severity: Warning
Message: fsockopen() [function.fsockopen]: Failed to enable crypto
Filename: libraries/Email.php
Line Number: 1673
我也试过
‘smtp_host’ => ‘sslv2://smtp.live.com’,
但它无法在我的本地机器上运行。 我在我的本地机器上使用 Windows 7,在系统上使用 Windows Xp 我将使用应用程序 [阻止 gmail 的应用程序]。我尝试了 XAMPP ver 1.8.1 和 WAMPP ver 2.2
期待您的回复
~muttalebm
最佳答案
错误是因为您没有在 php.info 文件中启用 SSL。所以搜索如何启用它。否则,您可以在下面的链接中查看我对问题的回答,这与此相同。我在做的时候遇到了这个错误,我解决了它。
关于codeigniter - 使用 hotmail 通过 CI 发送电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13717225/