无法验证密码。错误:535错误的身份验证 数据无法使用PHP SMTP通过
enter code here
发送电子邮件。您的 服务器可能未配置为使用此方法发送邮件。
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'mail.******.com',
'smtp_port' => 587,
'smtp_user' => 'tracker@******.com',
'smtp_pass' => '7Wj{S******KU{',
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE
);
$message = 'Hiii';
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
// $this->load->library('email');
$this->email->from('tracker@******.com'); // change it to yours
$this->email->to($usremail);// change it to yours
$this->email->cc('');
// $this->email->bcc('gobinath@******.com');
$this->email->subject('hi');
$this->email->message($message);
$mailsucc = $this->email->send();
if ($mailsucc) {
echo "suc";
exit();
}else{
$de = $this->email->print_debugger();
print_r($de);
exit();
}
答案 0 :(得分:0)
我已经寻找了一段时间,最后我明白了。我希望这也对您有用。
定义您的时区:
php timezone
date_default_timezone_set('America / Bogota');
设置您的电子邮件帐户以允许IMAP访问,并允许在安全性较低的应用程序中使用电子邮件
less secure apps
IMAP Access
使用codeigniter设置邮件服务器:
$this->load->library('email');
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.gmail.com';
$config['smtp_user'] = 'xxxxxxxxxx@gmail.com';
$config['smtp_pass'] = 'xxxxxxxxxxx';
$config['smtp_port'] = 465; (465/587)
$config['charset'] = 'utf-8';
$config['crlf'] = "\r\n";
$config['smtp_crypto'] = 'ssl'; (SSL/TSL)
$this->email->initialize($config);
$this->email->set_newline("\r\n");
准备发送邮件:
$this->email->from('xxxxxxxxxx@gmail.com', 'ANY-NAME');
$this->email->to('yyyy@yyy.yyy');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
if($this->email->send()){
echo "sent";
}
else{
echo $this->email->print_debugger();
}