2011-10-29 21 views
0

私はcodeigniterを使って電子メールを送信する方法を理解しようとしています。私はgmailアカウントを使って成功しました。Codeigniterでホットメールを使って電子メールを送信していますか?

しかし、問題は、私は自分の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

関連する問題