2016-08-17 112 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服务器,配置中是否有任何更改? –

回答

相关问题