[eluser]rainfall[/eluser]
I want to send mail with gmail id from CodeIgniter with gmail smtp.
But some error occurred . I just created a controller for testing purpose. When i click a link its send mail based on my configuration . Here is the mail code.. .
Code:
function __construct() {
parent::__construct();
// $this->load->library('email', $config);
}
function sendMail()
{
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '**********@gmail.com',// From
'smtp_pass' => '*********',// password
'mailtype' => 'html',
'charset' => 'iso-8859-1'
);
//$this->load->library('email', $config);
//$this->email->set_newline("\r\n");
$message = 'Hello';
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('**********@gmail.com'); // From
$this->email->to('********@gmail.com');//To
$this->email->subject('First Mail');
$this->email->message($message);
if($this->email->send())
{
echo 'Email sent.';
}
else
{
show_error($this->email->print_debugger());
}
}
I edited php.ini with
Code:
SMTP = smtp.googlemail.com
; http://php.net/smtp-port
smtp_port = 465
Code:
220 mx.google.com ESMTP v11sm6817390pas.24 - gsmtp
hello: 250-mx.google.com at your service, [103.230.104.8]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH XOAUTH2 PLAIN-CLIENTTOKEN
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
Failed to authenticate password. Error: 535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 http://support.google.com/mail/bin/answer.py?answer=14257 v11sm6817390pas.24 - gsmtp
..........................
.........................
.............................
lot of errors here ..
How can I solve this error ??