我想發送忘記密碼鏈接到Gmail。但無法取得成功。郵件不發送/刪除php codeigniter
這是我的小代碼。我在這裏有我的配置文件。如果需要更改,請提出建議。我使用兩個Gmail帳戶將郵件從一個Gmail帳戶發送到其他Gmail帳戶。
這裏是我的配置文件email.php
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
$config = Array(
$config['protocol'] = 'smtp',
$config['smtp_host'] = 'ssl://smtp.gmail.com',
$config['smtp_port'] = '465',
$config['smtp_timeout'] = '7',
$config['smtp_user'] = '[email protected]',
$config['smtp_pass'] = '123',
$config['charset'] = 'utf-8',
$config['newline'] = "\r\n",
$config['mailtype'] = 'text', // or html
$config['validation'] = TRUE // bool whether to validate email or not
);
這裏是我的郵件傳遞代碼。
if($this->form_validation->run())
{
//echo 1;
//echo validation_errors();
$this->load->library('email');
$reset_key = md5(uniqid());
$this->load->model('User_Model');
if($this->User_Model->update_reset_key($reset_key))
{
$this->email->from('[email protected]', 'data-+-');
$this->email->to($this->input->post('email'));
$this->email->subject('Reset you account password at Mahesh Makwana');
$message = "<p><h4>You or someone request to reset your password.</h4></p>";
$message.="<a href='".base_url(). "reset_password/".$reset_key."'>Click here to reset your password</a>";
$this->email->message($message);
if($this->email->send())
{
echo 'Kindly check your email '.$this->input->post('email').' to reset your password';
}
else
{
echo 'Cannot send email! Kindly contact to our customer service to help you.!';
}
}
else{
echo 1;
}
}
else
{
//echo 0;
//echo validation_errors();
$this->load->view('include/forgetpassword');
}
我認爲你是正確的,因爲當我嘗試發送郵件,谷歌郵件我與**審覈被阻止的登錄嘗試**。 – Mahi
郵件收件人(收件人)是否有此功能來接收郵件。 – Mahi
只有郵件發件人帳號應該允許應用程序 –