Gmail + SMTP + Linux + Email library


I have readed many posts about this problem but still I have some problems my initial config looks like this :
Quote: $configmail = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://',
'smtp_user' => '',
'smtp_pass' => 'password',
'smtp_port' => 465,
'wordwrap' => TRUE,
'mailtype' => 'text',
'charset' => 'utf-8'
$this->load->library('email', $configmail);

and the part of code that sends the mail :
Quote: $this->email->from('[email protected]', 'name');
echo $this->email->print_debugger();

and still I get this kind of output :

Quote:220 ESMTP s10sm13968098mue.27
hello: at your service, [xxx.xx.xx.xx]
250-SIZE 35651584
from: 250 2.1.0 OK s10sm13968098mue.27
to: 250 2.1.5 OK s10sm13968098mue.27
data: 354 Go ahead s10sm13968098mue.27
451 4.4.2 Timeout - closing connection. s10sm13968098mue.27
The following SMTP error was encountered: 451 4.4.2 Timeout - closing connection. s10sm13968098mue.27
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
User-Agent: CodeIgniter
Date: Sun, 28 Mar 2010 22:39:28 -0400
From: "name"
To: [email protected]
Subject: =?utf-8?Q?topic?=
Reply-To: "[email protected]"
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0

Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit


I have this on Linux Debian server if u want some kind of output just say. Can any one help me with this problem ?

Hi chik3n,

Few things to check since I had problems initially on Fedora:

1. Make sure your iptables (firewall) allows outbound and inbound on that port. Looking over your error return message I think you may be ok with that.

2. In your username in your config, make sure you put [email protected] That is, include the part.

Here is the thing, I'm using other php script from php classes to send email via php and gmail and it works just fine so something must be wrong in codeigniter, as for the firewall is all ok because that other script is working on the same port :/. Any other ideas ? Oh right I putted the '' on the end of the login and same story, nothing, is that posible that the problem is I got dots in login name ?


I'd try another email where login dont have dots, same thing :/.

Wish I knew more about SMTP but give this a try:

‘smtp_host’ => ‘ssl://’,

Nope :/ same thing I'm confused :/.

have you tried logging in to this gmail account via your browser?

some times when sending lots of test mails gmail thinks you're spamming and suspends the account.

Yes I can log in via the browser on the account so that is not the problem and I was trying to send only 3-7 email in period of 10-30 minutes so I think that spam we can canceled as well.

just tried your code (with my gmail account) and also got a timeout error. compared it with some working code and it seems gmail doesn't like either all or a combination of setting wordwrap, mailtype, charset and not setting new line char...

$configmail = array(
            'protocol' => 'smtp',
            'smtp_user' => '',
            'smtp_pass' => 'password',
            'smtp_port' => 465
          $this->load->library('email', $configmail);


            $this->email->from(‘[email protected]’, ‘name’);

            echo $this->email->print_debugger();

Obviously you could be a bit more scientific and investigate which of these is causing the problem and why Tongue

Still nothing, I try everything, even creating an new controler only to send one email and still nothing :/.

Any other ideas ?

this is my email config for gmail which works:

$config['protocol']     = 'smtp';
$config['smtp_host']    = 'ssl://';
$config['smtp_port']    = 465;
$config['smtp_user']    = '[email protected]';
$config['smtp_pass']    = 'MYPASSWORD';
$config['smtp_timeout'] = 30;
$config['newline']      = "\r\n";
$config['crlf']         = "\r\n";
$config['mailtype']     = 'html';
$config['charset']      = 'utf-8';

I cant remember - do you need to enable smtp in your gmail account or something mayube?

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.