Php 使用CodeIgniter 3.1.10发送电子邮件
我想发送电子邮件使用codeigniter,我看到如何使这在互联网上。但当我写代码时,电子邮件不会发送给人们 使用codeigniter 3.1.10Php 使用CodeIgniter 3.1.10发送电子邮件,php,codeigniter,Php,Codeigniter,我想发送电子邮件使用codeigniter,我看到如何使这在互联网上。但当我写代码时,电子邮件不会发送给人们 使用codeigniter 3.1.10 private function _sendEmail(){ $config = [ 'mailtype' => 'html', 'charset' => 'utf-8', 'protocol' => 'smtp', 'smtp_host' => 'ssl://smtp.gmai
private function _sendEmail(){
$config = [
'mailtype' => 'html',
'charset' => 'utf-8',
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.gmail.com',
'smtp_user' => '****',
'smtp_pass' => '****',
'smtp_port' => 465,
'crlf' => "\r\n"
];
$this->load->library('email',$config);
$this->email->from('vcopadangpariaman@gmail.com','VCO Padang Pariaman');
$this->email->to('taufikleon44@gmail.com');
$this->email->subject('Testing');
$this->email->message("hallo");
if($this->email->send()){
return true;
}else {
echo $this->email->print_debugger();
}
}
我想发电子邮件到taufikleon44@gmail.com这可能是因为SMTP身份验证中提供的用户名和密码错误,或者邮件服务器防火墙中的SMTP端口被阻止 如果您使用的是Gmail帐户,请检查此链接并关闭“允许不太安全的应用” 以下是网址: 然后再次尝试发送电子邮件 我已更新了您的代码并立即检查:
private function _sendEmail() {
$config = [
'mailtype' => 'html',
'charset' => 'utf-8',
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.gmail.com',
'smtp_user' => '****',
'smtp_pass' => '****',
'smtp_port' => '465',
'smtp_timeout' => '20',
'validation' => TRUE,
'newline' => "\r\n"
];
$this->load->library('email', $config);
$this->email->initialize($config);
$this->email->from('vcopadangpariaman@gmail.com', 'VCO Padang Pariaman');
$this->email->to('taufikleon44@gmail.com');
$this->email->subject('Testing');
$this->email->message("hallo");
if ($this->email->send()) {
return true;
} else {
echo $this->email->print_debugger();
}
}
对不起,我用英语写的不好。这些真实的用户和密码是什么?如果是的话,你是在损害那个电子邮件帐户!!