2011-10-29 29 views
0

我想弄清楚如何使用codeigniter發送電子郵件,併成功地使用我的Gmail帳戶。在Codeigniter中用hotmail發送郵件?

但問題是,我不知道如何使用我的Hotmail帳戶做...

繼承人它使用的Gmail代碼:

<?php 

class Email extends CI_Controller 
{ 
function index() 
{ 
     $config = array(
     'protocol' => 'smtp', 
     'smtp_host' => 'ssl://smtp.googlemail.com', 
     'smtp_port' => 465, 
     'smtp_user' => '[email protected]', 
     'smtp_pass' => 'Password' 

    ); 
    $this->load->library('email', $config); 
    $this->email->set_newline("\r\n"); 

    $this->email->from('[email protected]', 'Me'); 
    $this->email->to('AnotherGuy');  
    $this->email->subject('This is an email test');  
    $this->email->message('It is working. Great!'); 


    if($this->email->send()) 
    { 
     echo 'Your email was sent.'; 
    } 

    else 
    { 
     show_error($this->email->print_debugger()); 
    } 
} 

}

回答

0

使用類似代碼,但如前所述,您需要更改smtp變量。 的Hotmail: 服務器:smtp.live.com 端口:587

嘗試:

$config = array(
    'protocol' => 'smtp', 
    'smtp_host' => 'ssl://smtp.live.com', 
    'smtp_port' => 587, 
    'smtp_user' => '[email protected]', 
    'smtp_pass' => 'Password' 

); 

Source