[eluser]shiva478[/eluser]
I'm trying to send an email using codeigniter and gmail for some reason it doesn't work and I have checked the coding and I have researched to make sure it was right and everything does look right so I don't know what I've done wrong. When I use the
Code:
$this->email->print_debugger()
I get this error
Quote:An Error Was Encountered
220 mx.google.com ESMTP l6sm24694202wiz.4
hello: 250-mx.google.com at your service, [41.177.22.90]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH XOAUTH2
250 ENHANCEDSTATUSCODES
Failed to authenticate password. Error: 535-5.7.1 Username and Password not accepted. Learn more at 535 5.7.1 http://support.google.com/mail/bin/answe...swer=14257 l6sm24694202wiz.4
from: 530-5.5.1 Authentication Required. Learn more at
530 5.5.1 http://support.google.com/mail/bin/answe...swer=14257 l6sm24694202wiz.4
The following SMTP error was encountered: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 http://support.google.com/mail/bin/answe...swer=14257 l6sm24694202wiz.4
to: 530-5.5.1 Authentication Required. Learn more at
530 5.5.1 http://support.google.com/mail/bin/answe...swer=14257 l6sm24694202wiz.4
The following SMTP error was encountered: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 http://support.google.com/mail/bin/answe...swer=14257 l6sm24694202wiz.4
data: 530-5.5.1 Authentication Required. Learn more at
530 5.5.1 http://support.google.com/mail/bin/answe...swer=14257 l6sm24694202wiz.4
The following SMTP error was encountered: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 http://support.google.com/mail/bin/answe...swer=14257 l6sm24694202wiz.4
502 5.5.1 Unrecognized command. l6sm24694202wiz.4
The following SMTP error was encountered: 502 5.5.1 Unrecognized command. l6sm24694202wiz.4
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
This is my main controller
Code:
public function signup_validation()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('email', 'Email', 'required|trim|valid_email|is_unique[users.email]');
$this->form_validation->set_rules('password', 'Password', 'required|trim');
$this->form_validation->set_rules('cpassword', 'Confirm Password', 'required|trim|matches[password]');
$this->form_validation->set_message('is_unique', "That email address already exists");
if($this->form_validation->run())
{
//generate random key
$key = md5(uniqid());
$config = array(
'protocol' => 'smtp',
'mailtype' => 'html',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '[email protected]',
'smtp_pass' => 'something'
);
$this->load->library('email', $config);//, $config);//, array('mailtype'=>'html'));
$this->email->set_newline("\r\n");
$this->email->from('[email protected]', "Nicole");
$this->email->to($this->input->post('email'));
$this->email->subject("Confirm your account");
$message = "<p>Thank you for signing up!</p>";
$message .= "<p><a href='".base_url()."main/register_user/$key'>Click here</a>to confirm your account</p>";
$this->email->message($message);
if($this->email->send())
{
echo "The email has been sent";
} else {
echo "Could not send the email";
show_error($this->email->print_debugger());
}
//send an email to the user
//add them to the temp_users db
} else {
$this->load->view('signup');
}
}
and this is the signup view
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Signup Page</title>
</head>
<body>
<div id="container">
<h1>Signup</h1>
<?php
echo form_open('main/signup_validation');
echo validation_errors();
echo "<p>Email";
echo form_input('email', $this->input->post('email'));
echo "</p>";
echo "<p>Password";
echo form_password('password');
echo "</p>";
echo "<p>Confirm Password";
echo form_password('cpassword');
echo "</p>";
echo "<p>";
echo form_submit('signup_submit', 'Sign Up!');
echo "</p>";
echo form_close();
?>
</div>
</body>
</html>