这是我的代码:
$config = array(
'protocol' => 'smtps',
'smtp_host' => 'ssl://smtps.googlemail.com',
'smtp_user' => 'donotreply@eezybee.com',
'smtp_pass' => '******',
'smtp_port' => '465',
'mailtype' => 'html',
'smtp_timeout' => '4',
'newline' => "\r\n"
);
$this->email->initialize($config);
$this->email->to('donotreply@eezybee.com');
$this->email->cc();//$this->input->post('cctxt')
$this->email->from('donotreply@eezybee.com');
$this->email->subject('Test subject');
$this->email->message('Test message');
$this->email->send();
echo $this->email->print_debugger();
此电子邮件将进入垃圾邮件框。
答案 0 :(得分:0)
首先,您在Google的SMTP服务器中出错,它必须看起来像
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.gmail.com',
'smtp_user' => 'donotreply@eezybee.com',
'smtp_pass' => '******',
'smtp_port' => '465',
'mailtype' => 'html',
'smtp_timeout' => '4',
'newline' => "\r\n"
);
$this->email->initialize($config);
$this->email->to('donotreply@eezybee.com');
$this->email->cc();//$this->input->post('cctxt')
$this->email->from('donotreply@eezybee.com');
$this->email->subject('Test subject');
$this->email->message('Test message');
$this->email->send();
echo $this->email->print_debugger();
然后,为了实现这一点,您必须启用对Google帐户中安全性较低的应用的访问权限,因为您没有使用OAUTH。
Enable access For less Secure Apps
祝你好运!