|
发表于 2015-6-16 12:49:43
|
显示全部楼层
这是我的邮件测试代码,你对照修改一下相关参数,我这里测试没问题(PHP5.5.20, CI3.0,QQ企业邮箱)
PHP复制代码 $post_array = $this->input->post();
// 配置项
$config = array(
'protocol' => 'smtp',
'smtp_host' => trim($post_array['email_host']),
'smtp_user' => trim($post_array['email_id']),
'smtp_pass' => trim($post_array['email_pass']),
'smtp_port' => trim($post_array['email_port']),
'smtp_timeout' => '5',
'charset' => 'utf-8',
'mailtype' => 'text'
);
// 加载类库
$this->load->library('email', $config);
// 邮件
$this->email->from(trim($post_array['email_addr']), 'From email name');
$this->email->to(trim($post_array['email_test']));
$this->email->subject($this->lang->line('test_email'));
$this->email->message('test email!!');
// 发送
if($this->email->send())
{
// 成功信息
}
else
{
// 错误信息
} 复制代码
|
|