Gmail + SMTP + Linux + Email library

#1
[eluser]chik3n[/eluser]
Hi,

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.gmail.com',
'smtp_user' => 'my.login.name',
'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');
$this->email->to($reg_email);
$this->email->subject('topic');
$this->email->message('testowa');
$this->email->send();
echo $this->email->print_debugger();

and still I get this kind of output :

Quote:220 mx.google.com ESMTP s10sm13968098mue.27
hello: 250-mx.google.com at your service, [xxx.xx.xx.xx]
250-SIZE 35651584
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH
250-ENHANCEDSTATUSCODES
250 PIPELINING
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"
Return-Path:
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

testowa

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

#2
[eluser]2think[/eluser]
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 @gmail.com part.

#3
[eluser]chik3n[/eluser]
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 '@gmail.com' on the end of the login and same story, nothing, is that posible that the problem is I got dots in login name ?

Edit:

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

#4
[eluser]2think[/eluser]
Wish I knew more about SMTP but give this a try:

‘smtp_host’ => ‘ssl://smtp.googlemail.com’,

#5
[eluser]chik3n[/eluser]
Nope :/ same thing I'm confused :/.

#6
[eluser]eoinmcg[/eluser]
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.

#7
[eluser]chik3n[/eluser]
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.

#8
[eluser]eoinmcg[/eluser]
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...

Code:
$configmail = array(
            'protocol' => 'smtp',
            'smtp_user' => 'my.login.name',
            'smtp_pass' => 'password',
            'smtp_port' => 465
            );
          $this->load->library('email', $configmail);

            $this->email->set_newline("\r\n");

            $this->email->from(‘[email protected]’, ‘name’);
            $this->email->to($reg_email);
            $this->email->subject('topic');
            $this->email->message('testowa');
            $this->email->send();

            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

#9
[eluser]chik3n[/eluser]
Still nothing, I try everything, even creating an new controler only to send one email and still nothing :/.

Any other ideas ?

#10
[eluser]theshiftexchange[/eluser]
this is my email config for gmail which works:

Code:
$config['protocol']     = 'smtp';
$config['smtp_host']    = 'ssl://smtp.googlemail.com';
$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.