220 smtp.googlemail.com ESMTP u204sm18168305wmu.30 - gsmtp
hello: 250-smtp.googlemail.com at your service, [39.52.29.14]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
Failed to authenticate password. Error: 534-5.7.9 Application-specific password required. Learn more at 534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor u204sm18168305wmu.30 - gsmtp
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
Date: Tue, 5 Feb 2019 09:56:37 +0100
From: <mansha.qarib777@gmail.com>
Return-Path: <mansha.qarib777@gmail.com>
To: mansha.qarib777@gmail.com
Subject: =?ISO-8859-1?Q?=53=69=67=6E=75=70=20=56=65=72=69=66=69=63=61=74=69=6F=6E?= =?ISO-8859-1?Q?=20=45=6D=61=69=6C?=
Reply-To: <mansha.qarib777@gmail.com>
User-Agent: CodeIgniter
X-Sender: mansha.qarib777@gmail.com
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <5c594fc5296c6@gmail.com>
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="B_ALT_5c594fc5296d5"
This is a multi-part message in MIME format.
Your email application may not support this format.
--B_ALT_5c594fc5296d5
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Thank you for Registering.
Your Account:
Email: mansha.qarib777@gmail.com
Password: 12345678
Please click the link below to activate your account.
Activate My Account
<?php
class Employee_Model extends CI_Model{
function __construct(){
parent::__construct();
$this->load->database();
$this->load->library('session');
}
//insert employee details to employee table
public function insertEmployee($data){
return $this->db->insert('employee',$data);
}
public function loginUser($username, $password){
//$this->db->where(array('username' = >$username, 'password' => $password));
$query = $this->db->get_where('employee', array('username' => $username, 'password' => $password,'status'=> 0)); //status sholud be 1
if($query->num_rows() == 1){
$userArr = array();
foreach($query->result() as $row){
$userArr[0] = $row->emp_id;
$userArr[1] = $row->emp_name;
}
$userData = array(
'emp_id' => $userArr[0],
'emp_name' => $userArr[1],
'logged_in'=> TRUE
);
$this->session->set_userdata($userData);
return $query->result();
}else{
return false;
}
}
//send confirm mail
public function sendEmail($receiver){
$from = "mansha.qarib777@gmail.com"; //senders email address
$subject = 'Verify email address'; //email subject
//sending confirmEmail($receiver) function calling link to the user, inside message body
$message = 'Dear User,<br><br> Please click on the below activation link to verify your email address<br><br>
<a href=\'http://www.localhost/codeigniter/Signup_Controller/confirmEmail/'.md5($receiver).'\'>http://www.localhost/codeigniter/Signup_Controller/confirmEmail/'. md5($receiver) .'</a><br><br>Thanks';
//config email settings
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.gmail.com';
$config['smtp_port'] = '465';
$config['smtp_user'] = $from;
$config['smtp_pass'] = 'DEveloper!9090'; //sender's password
$config['mailtype'] = 'html';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = 'TRUE';
$config['newline'] = "\r\n";
$this->load->library('email', $config);
$this->email->initialize($config);
//send email
$this->email->from($from);
$this->email->to($receiver);
$this->email->subject($subject);
$this->email->message($message);
$this->email->send();
echo $this->email->print_debugger();
die();
if($this->email->send()){
//for testing
echo "sent to: ".$receiver."<br>";
echo "from: ".$from. "<br>";
echo "protocol: ". $config['protocol']."<br>";
echo "message: ".$message;
return true;
}else{
echo "email send failed";
return false;
}
}
//activate account
function verifyEmail($key){
$data = array('status' => 1);
$this->db->where('md5(email)',$key);
return $this->db->update('employee', $data); //update status as 1 to make active user
}
}
?>