我是codeigniter的初学者,我想从codeigniter发送一封电子邮件到gmail,代码如下所示,
电子邮件中的电子邮件配置。控制器
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.google.email.com',
'smtp_port' => '465',
'smtp_user' => 'manju.gate2013@gmail.com',
'smtp_pass' => '*****'
);
然后我加载库
$this->load->library('email',$config);
然后我将所需的数据从、到、密码、主题和消息传递到电子邮件库,
$this->email->from('manju.gate2013@gmail.com');
$this->email->to('manjunath861@gmail.com');
$this->email->subject('this is testing email');
$this->email->message('It is working');
最后我使用休闲条件检查我的电子邮件是否发送
if($this->email->send()==true){
echo "your mail was sent";
}
else{
show_error($this->email->print_debugger());
}