2012-12-05 31 views
3

我正嘗試使用CI創建電子郵件通知系統。問題是我工作的系統已經阻止了Gmail。所以,我無法使用Gmail的SMTP。現在,我必須找出一種使用hotmail或任何其他SMTP服務發送電子郵件的方法。 這裏是我的代碼工作了Gmail,但現在的Hotmail 配置/ Email.php:使用hotmail使用CI發送電子郵件

$config = array(
    'protocol' => 'smtp', 
    'smtp_host' => 'ssl://smtp.live.com', 
    'smtp_port' => 587, 
    'smtp_user' => '[email protected]', 
    '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('[email protected]','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版本1.8.1和WAMPP試圖版本2.2

期待您的答覆

〜muttalebm

回答

1

因爲你沒有啓用您的php.info文件SSL錯誤。 SO搜索如何啓用它。否則,你可以看看我的答案在下面的鏈接這是相同的謊言這個問題。我在做這件事時遇到了這個錯誤,我解決了它。

Reference Link

+0

嗨venkat,謝謝。我已啓用open_ssl並仍然面臨問題。請注意,該代碼可以正常使用gmail。問題在於我將運行我的應用程序的服務器不允許使用gmail。所以,我需要用一個Microsoft帳戶來解決它。 live,hotmail等,但hotmail或live也不能在我的本地機器上運行。請讓我知道,如果你曾與Hotmail smtp與ci – muttalebm

+0

偉大的是,端口號正確.....一次嘗試與465 ..... –

+0

你好再次,我已經嘗試過與465它給這個警告:fsockopen ()[function.fsockopen]:SSL:crypto啓用超時和fsockopen()[function.fsockopen]:無法連接到ssl://smtp.live.com:465(未知錯誤) – muttalebm