2016-08-17 37 views
0

我在codeigniter中使用smtp,我試過這段代碼。如何從本地服務器發送郵件?

$config = Array(
       'protocol' => 'smtp', 
       'smtp_host' => 'ssl://smtp.googlemail.com', 
       'smtp_port' => 465, 
       'smtp_user' => '[email protected]', // change it to yours 
       'smtp_pass' => 'xxx', // change it to yours 
       'mailtype' => 'html', 
       'charset' => 'iso-8859-1', 
       'wordwrap' => TRUE 
      ); 
       $this->load->library('email', $config); 
       $this->email->set_newline('\r\n'); 
       $this->email->from('[email protected]', 'Testing'); 
       $this->email->reply_to('[email protected]', 'Testing'); 
       $this->email->to('[email protected]'); 
       $this->email->cc('[email protected]'); 
       $this->email->subject('Testing'); 
       $this->email->message($message); 
       $this->email->send(); 

但我不明白什麼smtp_user和smtp_pass我必須給。任何人都可以聯繫我!

+1

可能重複[無法在本地主機上發送電子郵件爲什麼?](http://stackoverflow.com/questions/13376362/cant-send-email-on-my-local-host-why ) –

+0

你的gmail的用戶名和密碼,這是它 –

+0

我申請但仍然郵件沒有收到,我使用的是wamp服務器,配置中是否有任何更改? –

回答

相關問題