Jump to content

Recommended Posts

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

$this->email->print_debugger() 

 

I get this error

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/answer.py?answer=14257 l6sm24694202wiz.4

from: 530-5.5.1 Authentication Required. Learn more at

530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=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/answer.py?answer=14257 l6sm24694202wiz.4

to: 530-5.5.1 Authentication Required. Learn more at

530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=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/answer.py?answer=14257 l6sm24694202wiz.4

data: 530-5.5.1 Authentication Required. Learn more at

530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=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/answer.py?answer=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

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' => 'something@gmail.com',
         'smtp_pass' => 'something'
         
          
   );
   
   $this->load->library('email', $config);//, $config);//, array('mailtype'=>'html'));
   
   
   $this->email->set_newline("\r\n");
   
   $this->email->from('something@gmail.com', "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

<!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> 

Link to comment
https://forums.phpfreaks.com/topic/268548-email-with-codeigniter/
Share on other sites

Username and Password not accepted

Obviously the username and/or password is not correct, or at least not accepted. So if you're 100% sure that they are correct, by means of var_dump () or similar, then the only thing you can do is to ask Google support about why their servers aren't accepting the credentials.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.