Php 使用codeigniter从xampp发送电子邮件
我在尝试使用codeigniter发送电子邮件时遇到错误。我已经在一个在线服务器上测试了我正在使用的函数,但是它仍然抛出相同的错误 以下是我的职责:Php 使用codeigniter从xampp发送电子邮件,php,codeigniter,email,gmail,Php,Codeigniter,Email,Gmail,我在尝试使用codeigniter发送电子邮件时遇到错误。我已经在一个在线服务器上测试了我正在使用的函数,但是它仍然抛出相同的错误 以下是我的职责: //send email function sendEmail() { $config = Array( 'protocol' => 'smtp', 'smtp_host' => 'ssl://smtp.googlemail.com', 's
//send email
function sendEmail() {
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'email', // change it to yours
'smtp_pass' => 'pswd', // change it to yours
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE
);
$message = 'Test message';
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('zzz@gmail.com'); // change it to yours
$this->email->to('xxx@gmail.com'); // change it to yours
$this->email->subject('Resume from JobsBuddy for your Job posting');
$this->email->message($message);
if ($this->email->send()) {
echo 'Email sent.';
} else {
show_error($this->email->print_debugger());
}
}
我得到以下错误:
无法验证密码。错误:534-5.7.14请通过登录
请使用web浏览器和534-5.7.14,然后重试。534-5.7.14了解更多信息
5345.7.14
w84sm8590284ioi.20-gsmtp无法使用PHP SMTP发送电子邮件。你的
服务器可能未配置为使用此方法发送邮件
请协助答案与代码无关,但由于您的Gmail帐户必须启用才能允许smtp/IMAP访问。从:
答案与代码无关,但这是因为您的Gmail帐户必须启用才能允许smtp/IMAP访问。从:
你把这两个都改了吗<代码>'smtp\U user'=>'电子邮件','smtp\U pass'=>'pswd',这正是它所说的。您需要编辑您的Google帐户设置以允许访问smtp。Google帮助中的可能重复:登录到Gmail web界面。打开“设置”页面上的“转发和POP/IMAP”选项卡,然后配置IMAP或POP。在Gmail中启用此功能后,请确保单击“保存更改”,以便Gmail可以与您的邮件通信client@apdulla看标题…你把这两个都改了吗<代码>'smtp\U user'=>'电子邮件','smtp\U pass'=>'pswd',这正是它所说的。您需要编辑您的Google帐户设置以允许访问smtp。Google帮助中的可能重复:登录到Gmail web界面。打开“设置”页面上的“转发和POP/IMAP”选项卡,然后配置IMAP或POP。在Gmail中启用此功能后,请确保单击“保存更改”,以便Gmail可以与您的邮件通信client@apdulla看标题。。