0
votes

I am using the the following settings for Gmail SMTP mail sending using CodeIgniter mail class library: ![gmail settings][1]

Mail Server* :  smtp.gmail.com
Username* : [email protected]
Password* : **********
Port* : 567
SMTP_crypto* : TLS
From Address* : [email protected]
Reply To* : [email protected]

But its giving me the following error:

The following SMTP error was encountered: 110 Connection timed out Unable to send data: AUTH LOGIN Failed to send AUTH LOGIN command. Error: Unable to send data: MAIL FROM: from: The following SMTP error was encountered: Unable to send data: RCPT TO: to: The following SMTP error was encountered: Unable to send data: DATA data: The following SMTP error was encountered: Unable to send data: User-Agent: CodeIgniter Date: Tue, 11 Nov 2014 12:11:22 +0300 From: "GALTech Staffs" Return-Path: Reply-To: "GALTech Staffs" To: [email protected] Subject: =?utf-8?Q?Hello_Reena?= X-Sender: [email protected] X-Mailer: CodeIgniter X-Priority: 1 (Highest) Message-ID: <[email protected]> Mime-Version: 1.0 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Copyright © 2014 Mailing System, All rights reserved.

Unable to send data: .

The following SMTP error was encountered: Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method. User-Agent: CodeIgniter Date: Tue, 11 Nov 2014 12:11:22 +0300 From: "GALTech Staffs" Return-Path: Reply-To: "GALTech Staffs" To: [email protected] Subject: =?utf-8?Q?Hello_Reena?= X-Sender: [email protected] X-Mailer: CodeIgniter X-Priority: 1 (Highest) Message-ID: <[email protected]> Mime-Version: 1.0

Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

Hello Reena


Copyright © 2014 Mailing System, All rights reserved.
3
Gmail uses outgoing smtp port 587 for tls connection.HddnTHA

3 Answers

0
votes

Use port 587 in combination with TLS or port 465 with SSL.

0
votes

Try this in a function to send mail :
Hope it works!

$config = array(
                        'protocol' => 'smtp',
                        'smtp_host' => 'ssl://smtp.googlemail.com',
                        'smtp_port' => 465,
                        'smtp_user' => '[email protected]', 
                        'smtp_pass' => 'abcd',
                                        );

                        $message = 'Your mail message here.';
                        $this->load->library('email', $config);
                        $this->email->set_newline("\r\n");
                        $this->email->clear();
                        $this->email->from('[email protected]');
                        $this->email->to('[email protected]');   //To whom you are sending.
                        $this->email->subject('Your mail subject');
                        $this->email->message($message);
                        if($this->email->send())
                                 {
                                    return true;
                                 }
                                    else
                                 {
                                    return false;
                                 }  

                             }
0
votes

Actually it was a library coding error. I have fixed it using the following link: https://github.com/ivantcholakov/codeigniter-phpmailer